由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - question on single thread & multithread
相关主题
如何让两个socket并行执行threadRe: [转载] 如何看某个端口是否被占用?(use UNIX command or ..)
Socket Connection refused in high-loaded serversa Java MultiThreading question
怎么练习java multithreadBasic thread question
multi-threading guru们 (转载)multiple classes in one file:revisted
怎么学multithreading/concurrency?How to ues log4j to send log email in the multithreaded processes as similiar with single-threaded
问个primitive type的问题怎么可以练习多线程编程呢?
thread independent on a single-cpu machine?请教大家:如何modify java code in order to compile
Re: Help!!! Java in Unix. Thread. I need exit and ls concurrently runn求问如何学习multithreading
相关话题的讨论汇总
话题: thread话题: single话题: question话题: listens
进入Java版参与讨论
1 (共1页)
g****n
发帖数: 18
1
Hello everyone,
I am new to Java and have to ask a simple question.
I am writing a program that has two sockets s1 and s2.
s1 listens to a single client and uses a single thread
s2 listens to possible multiple clients and uses a multithread to track number
of connections, by group.activeCount();
It requires both the single thread and multithread run at the same time. And
the multithread's group.activeCount() needs to be passed to the single thread
every time a thread in the multithread starts or
c****e
发帖数: 90
2
Try the following code and you'll see why.
For primitive types, java just copy the value
(instead of passing the reference of that object)
when passing parameters.
class t {
private static void modify(int val)
{
val += 1;
System.out.println("Value of integer inside: "+val);
}
public static void main(String []args){
int t = 0;
modify(t);
System.out.println("Value of integer outside: "+t);
}
}

number
thread
is

【在 g****n 的大作中提到】
: Hello everyone,
: I am new to Java and have to ask a simple question.
: I am writing a program that has two sockets s1 and s2.
: s1 listens to a single client and uses a single thread
: s2 listens to possible multiple clients and uses a multithread to track number
: of connections, by group.activeCount();
: It requires both the single thread and multithread run at the same time. And
: the multithread's group.activeCount() needs to be passed to the single thread
: every time a thread in the multithread starts or

1 (共1页)
进入Java版参与讨论
相关主题
求问如何学习multithreading怎么学multithreading/concurrency?
java concurrency (转载)问个primitive type的问题
Re: Client-Server and actionPerformedthread independent on a single-cpu machine?
one questionRe: Help!!! Java in Unix. Thread. I need exit and ls concurrently runn
如何让两个socket并行执行threadRe: [转载] 如何看某个端口是否被占用?(use UNIX command or ..)
Socket Connection refused in high-loaded serversa Java MultiThreading question
怎么练习java multithreadBasic thread question
multi-threading guru们 (转载)multiple classes in one file:revisted
相关话题的讨论汇总
话题: thread话题: single话题: question话题: listens