Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/384.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在通话中共享两个频道的公共id_Java_Freeswitch - Fatal编程技术网

Java 如何在通话中共享两个频道的公共id

Java 如何在通话中共享两个频道的公共id,java,freeswitch,Java,Freeswitch,我正在freeswitch中研究两个应用程序之间的通信,我在java程序中完成了以下工作: ProcessBuilder processBuilder = new ProcessBuilder( "/bin/bash", "-c", "cd /usr/local/freeswitch/bin && ./fs_cli -x \"originate loopback/1234/default &bridge(sofia/internal/1789)\"" ); process

我正在freeswitch中研究两个应用程序之间的通信,我在java程序中完成了以下工作:

ProcessBuilder processBuilder = new ProcessBuilder( "/bin/bash", "-c", "cd /usr/local/freeswitch/bin && ./fs_cli -x \"originate loopback/1234/default &bridge(sofia/internal/1789)\"" );
processBuilder.start();

它工作得很好,我只想运行相同的程序更多次来测试系统性能,所以如果我需要运行它更多次,我只想在调用中的通信通道之间共享一个公共id,请建议一些可以共享公共变量的方法,请帮我让类实现runnable

class myRunnable implements Runnable
{

    int commonId = 1234; // all threads have this same common id
    public void run()
    {

         // do something with the common id

         // all threads share this common code
         ProcessBuilder processBuilder = new ProcessBuilder( "/bin/bash", "-c", "cd /usr/local/freeswitch/bin && ./fs_cli -x \"originate loopback/1234/default &bridge(sofia/internal/1789)\"" );
         processBuilder.start();
    }
}
创建并启动一个线程

int i=0,n=5;
for(i=0;i<n;i++) new Thread(new myRunnable).start(); // this will fire off 5 threads
inti=0,n=5;

对于(i=0;iThanks for reply,很抱歉这纯粹是与freeswitch java相关的问题,所以我需要一个ESL客户机方法来在一个调用中共享公共变量或id,而不是进程的id)