小编Jay*_*yan的帖子

BTrace的开销是多少?

在BTrace文档中提到BTrace在空闲时几乎没有开销.这是否意味着BTrace仅具有开销,并且仅在满足某些探测并且正在处理时?

此外,在处理Probe时,需要一些CPU来进行处理.但它是否会对JVM内存或任何其他可能影响原始JVM进程处理的事情产生影响?

java trace jvm btrace

6
推荐指数
1
解决办法
570
查看次数

Java - Desktop.getDesktop().browse(URI) 受支持,但不打开文档(citrix 问题?)

(我不确定这是否是提出此问题的正确位置。请移至合适的站点)

我有一个问题,显示在下面的代码中。它不适用于装有 CITRIX Xen App 6- 的机器(windows 2008)。没有错误,只是浏览器没有启动。在我的桌面(一个 windows7 盒子)上,它可以工作。

package trials;

import java.awt.*;
import java.io.File;
import java.io.IOException;


public class Launch {

    public static void main(String[] args) throws IOException {
        if (args.length < 1) {
            System.out.println("argument filepath expected");
            return;
        }

        final boolean browseSupported = Desktop.getDesktop().isSupported(Desktop.Action.BROWSE);
        if ( !browseSupported) {
            System.out.println("Browse not supported");
            return;
        }

        final String filename = args[0];
        final File file = new File(filename);
        if (file.exists()) {
            Desktop.getDesktop().browse(file.toURI());
        } else {
            System.out.println(file.getAbsolutePath() + " does not exist");
        }
    } …
Run Code Online (Sandbox Code Playgroud)

java windows 64-bit citrix xenapp

6
推荐指数
2
解决办法
1万
查看次数

IllegalAccessError:class <classname>无法访问其超接口<interfacename>

我有类汇编实现IAssembly.

启动应用程序时看到以下错误

Caused by: java.lang.IllegalAccessError: class <Assembly > cannot access its superinterface <IAssembly>
        at java.lang.ClassLoader.defineClass1(Native Method)
Run Code Online (Sandbox Code Playgroud)

汇编代码

class package.Assembly implements IAssembly {

}
Run Code Online (Sandbox Code Playgroud)

IAssembly

interface IAssembly { //note -this is not public, so uses default protected

}
Run Code Online (Sandbox Code Playgroud)

装配和IAssembly存在于两个不同的罐子中.两个罐子都由不同的类加载器加载.Assembly类加载在子类加载器中,IAssembly是父类.类加载器正在使用链接.

在正常情况下,这是有效的.在使用cobertura检测罐子后运行我的应用程序时发生错误.没有仪器,一切正常.cobertura仪器会导致这样的错误吗?或者这是一个等待被检测到的错误,但是对于cobertura,错误很快就会暴露出来.

通过使界面"公开",错误消失了.

java cobertura classloader

6
推荐指数
1
解决办法
7301
查看次数

<zipfileset>与ant中的<fileset>

ant构建工具提供了两个不同的任务<fileset/><zipfileset/>.根据文档<zipfileset/>,如果我们使用src属性,我们可以从.zip文件中提取文件.

我的问题是,如果我们使用dir属性来选择文件,那么两者之间有什么区别, <zipfileset/><fileset/>.

例如

                <zipfileset dir="conf/Gateway>
                <include name="jndi.properties" />
                </zipfileset>

                                 and

                <fileset dir="conf/Gateway>
                <include name="jndi.properties" />
                </fileset>
Run Code Online (Sandbox Code Playgroud)

ant

6
推荐指数
1
解决办法
7429
查看次数

将一个数字列表分成较小的列表,其中"sum"大致相同

我在网格上执行大约2000次测试,每次测试都作为网格上的单独任务运行.测试确实有很大的启动时间.总执行需要500个小时,在60个节点SunGridEngine上完成不到10个小时.测试运行时间从5分钟到90分钟不等.结合没有太多智能的测试可以获得一些性能提升.我想创建大小相等的"任务".我怎么能这样做?

(我们现在做的是:对所有测试进行排序并继续添加,直到执行时间总和大约为5小时.寻找更好的东西)

java algorithm grid graph set

5
推荐指数
1
解决办法
1266
查看次数

管理员帐户下的 postgres-start 进程

是否可以使用具有“管理”权限的用户帐户启动 postgres 进程?我在 Windows XP 上。

--错误显示是---(不是真正的错误,这是一个安全功能)

The server must be started under an unprivileged user ID to prevent
possible system security compromises.  See the documentation for
more information on how to properly start the server.
Run Code Online (Sandbox Code Playgroud)

当前的解决方法是创建普通用户并在其下运行进程。我正在寻找的是启动数据库、执行一些操作并将其作为构建过程的一部分关闭的快速方法。

windows postgresql

5
推荐指数
1
解决办法
3945
查看次数

intellij-idea - 如何向模块添加自定义构建步骤

我正在使用IntelliJ(8.x).构建步骤需要外部的ant"ant"从.idl文件生成java文件.这使用了jacorb.我想避免这一步.目前的解决方法是使用"外部工具"调用一些脚本.这有效,但我想可能有更好的方法来做到这一点..

是否可以从IntelliJ调用自定义构建步骤,因此它被调用我们制作或编译模块?

ide intellij-idea

5
推荐指数
1
解决办法
1962
查看次数

Java - 单元测试

在Java类中给出此方法:

public void execute(String command) {

    ProcessBuilder processBuilder = new ProcessBuilder(command);
    Process process = processBuilder.start();

    int exitValue = process.waitFor();
    if (exitValue != 0) {
        throw new RuntimeException("a message here...");
    }
}
Run Code Online (Sandbox Code Playgroud)

我正在尝试为这种方法提出适当的跨平台单元测试.

我正在寻找所有操作系统(Win,Linux,Mac和...)的常用命令,或者我可以在单元测试中传递给此方法的假命令.

有什么建议吗?

java junit unit-testing

5
推荐指数
1
解决办法
2634
查看次数

LocalStorage vs Sqlite数据库

我有一个在Android和ios平台上运行的混合应用程序,我一直使用"localStorage"作为数据存储.

我也听过sqlite,还有其他我可以用于移动存储的本地数据库吗?

我想知道这些技术的支柱和缺点.

如果有人能澄清这些技术我真的很感激.

sqlite android ios cordova

5
推荐指数
1
解决办法
3783
查看次数

perl mocking有没有办法模拟$?

Test::MockModule用来测试perl模块.其中一个调用需要检查状态$?以获取错误代码并对其进行程序检查.

我怎么能模仿结果呢? $?

被测代码如下所示.

my $result = CCUtil::cleartool($cmd);

if ( $? != 0 ) {
    confess  "Stream $stream not found( $result) ";
}
Run Code Online (Sandbox Code Playgroud)

api返回字符串并设置$?用于检查状态.

正常方法调用及其返回值使用如下所示进行更改

my $module = Test::MockModule->new('CCUtil');
$mockModule->mock(cleartool => sub {return 'stream not found'});
Run Code Online (Sandbox Code Playgroud)

现在模拟了方法调用.不是 - 的价值 - $?

perl unit-testing mocking

5
推荐指数
1
解决办法
101
查看次数