| How to kill thread which is blocked by Serversocket.accept()? |
|
 |
Index ‹ java-programmer
|
- Previous
- 1
- Signed applet focus problem,.Hello,
I have a jsp page which contains a signed applet which reads some
System properties.
I am using jdk 1.4.2_06. and IE 6.028.
When the signed certificate appears, if I click on the Internet
Explorer icon in the task bar, the certificate goes below the browser.
Now since the certificate is supposedly modal, My browser loses focus.
ie. I cannot bring the certificate to the front sans tabbing and the
browser will not respond to user input. The only way to get the
certificate to the front is by "tabbing" till I get to it.
Any one seen this behavior before? If so any suggestion would be
appreciated.
Thanks
Karl.
- 2
- OutOfMemory on Sun Java 1.4.2 on LinuxHi all,
My application (on JBoss) is experiencing strange problem on one of our
environment - on Linux on Itanium 2 - Sun Java 1.4.2_07 and 64 bit.
On all other platforms (windows, linux, 32 bit) is ok.
After 2-3 http requests the OutOfMemory exception is thrown.
Java is started with -Xmx1024M. In fact the bahaviour is exactly the
same as -Xmx512M.
'uname -a' shows unlimited resources for memory.
There is plenty of free memory in the system (main and swap) - for
example I can run 3 such java processes at the same time - but each is
reporting out of memory after few requests as it is for one java spawned.
'top' shows that java eats ~400M when the OutOfMemory is thrown.
Where to look, what to check?
taab
- 6
- Refer to current filename and line.Hi,
I remember this was possible in C with macros. Is it possible in Java
to refer to the current file name and line number as in
System.out.println( something.that.returns.current.file.name() + "
printed this line.");
Many thanks in advance!
Aaron
- 7
- OMLETv4: SPAM SPAM SPAM
--
Daniel A. Morgan
University of Washington
email***@***.com
(replace 'x' with 'u' to respond)
- 7
- Two questions about jars1) I need to support installing a Java application from CD on both Windows
AND on the Mac. I have figured out how autorun works on Windows. Is the
method for doing this the same on the Mac as it is for Windows? I am
thinking that what I'd do is create an install "program" (like the Setup
program created by Install Shield on Windows), but make it as an executible
jar file so that the Java VM on either can handle the install process. That
way, a single CD should be able to accomodate both the Mac and Windows.
2) I have found the process of making executible jar files a little
problematic, and the documentation from Sun with the SDK a little lacking in
examples: and the documentation with eclipse and Netbeans IDE is a bit of a
maze (I'd have thought that both would make it easy to create executible
jars, but I haven't found the relevant parts of their documentation yet, so
I am still struggling with hat from Sun). I understand that to make a jar
executible, I need to provide a manifest file, but I have yet to succeed in
adding one. Can anyone point me to a simple example of making an executible
jar containing a Swing application, or provide me with one (if that is
simple enough)? (And/or provide a map pointing out the relevant parts of
the documentation I have acquired) I need this jar to be self contained, so
I do not need to worry about what version of the JRE the client machine has.
I guess I ought to add a third question about whether or not either eclipse
or netbean supports making a distribution as an executible jar file that
will install the application on the client machine and create any necessary
directories and icon on the desktop? I have found, though, a couple tools
that should be able to do this, but I haven't been able to test them because
I got stuck on the question of creating executible jar files.
I am certain I can figure this out on my own, but the big problem is I am
facing significant time pressure, so I ask for aide to help me get this
figured out faster.
Thanks,
Ted
- 8
- Java and MySql program example ?I am trying to learn Java and need an example program with MySql
database.
I am sure there are many who have made an invoice program in Java with
MySql database. The program must have routines that are similar to
those an invoice program has: customers, orders, products. Screens
like orders head and orderlines.
Can you please send me a copy of the source files for such a program
or a different program?
- 10
- Runtime - external program visibility
Hello,
i use the getRuntime method to start an external program out of
my Java app: Runtime.getRuntime().exec(cmd);
where cmd is an array of String
String[] cmd =
{ "\"c:/Whatever.exe\"","/user=User","/password=XXX"};
Now the issue is that the program (Whatever.exe) starts, it
accepts the parameters (user,password), - the / is required by
Whatever.exe - but the window of the application Whatever.exe is
not visible! The process is there (one can see it in the
taskmanager).
In Delphi i have the possibility by using Windows.CreateProcess
and passing a "StartupInfo"
(lStartupInfo.dwFlags:= STARTF_USESHOWWINDOW;
lStartupInfo.wShowWindow:= SW_SHOWNORMAL;) but here in Java i dont see a possibility of determining in which way the external app is being started up or determining its visibility.
kind regards
Oliver
- 10
- Adding JPanel to JLayeredPane - Please help!Hi
I have a problem adding a JPanel to a JLayeredPane.
The class ChartGraphics paints a system of coordinats / Chart on a
JPanel
using the paint() metode. When I add the ChartGraphics object directly
to the Contentpanel of the frame the Chart is shown without any
problems. But as I want to add some buttons on top of the Chart, I
want to place it in a JLayeredPanel, and afterwards add the Jbuttons.
The problem is that the Chart is'nt shown if it is placed in the
JLayeredpane, why? The Button is displayed nicely.
Can anybody tell me how to display my JPanel background from the
JlayeredPane?
/Thanks
Kristian
******************ShowTrendsTest *******************
public class ShowTrendsTest {
public static void main(String[] args) {
JFrame f = new JFrame("ShowTrends");
ChartGraphics Chart = new ChartGraphics();//extends JPanel
JButton button = button("TST"); //Just a JButton
JLayeredPane layeredPane = new JLayeredPane();
layeredPane.add(Chart, new Integer(0));
layeredPane.add(button, new Integer(1));
f.getContentPane().add(layeredPane);
f.pack();
f.show();
}
public static JButton button(String arg){
JButton b1 = new JButton(arg);
b1.setVerticalAlignment(JButton.TOP);
b1.setHorizontalAlignment(JButton.CENTER);
b1.setOpaque(true);
b1.setBackground(Color.red);
b1.setForeground(Color.black);
b1.setBounds(100, 100, 140, 140);
return b1;
}
}
********************************************
- 11
- Resizing images thru a java program
hi
I need to capture an image based on the URL of the image provided by
the user and do the following things
1. Create a thumbnail
2. Resize the image
I may have to store these two images locally or just recreate these two
images and display it in the browse.
What are the best tools to use to achieve this? I need a Linux/java
based solution. Will Imagemagick.org do the magic?
-- Mahesh
- 11
- Mars Rescue Mission ChallengeA new challenge:
http://www.frank-buss.de/marsrescue/index.html
Have fun! Now you can win real prices.
--
Frank Bu? email***@***.com
http://www.frank-buss.de, http://www.it4-systems.de
- 11
- reference to a jar file inside another jar fileHi, I need create a manifest file for a jar, but I need set the classpath in
the manifest file to reference a jar file inside the current jar file. My
idea is getting a single jar file which contains all the needed jar files.
- 11
- Reference sitesDoes anyone have a list of reference websites that are running FreeBSD
and Java?
Or does anyone know of any high volume sites using FreeBSD and Java?
Thanks,
Todd
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 13
- Execute jar in program codeI have a jar file, without source code, say abc.jar.
I have set it in the CLASSPATH
The main execute class in abc.jar is a.class.
In the command prompt, I can execute the program by
issuing "java a < someIOfile"
But I would be like to embed it in my program.
Can I create a "dynamic" instance from it?
- 14
- what the problem about this short code?import javax.media.Manager;
import javax.media.bean.playerbean.MediaPlayer;
import java.lang.String;
public class Player1 {
MediaPlayer mp1 = new MediaPlayer();
public Player1(){
mp1.setMediaLocation(new String("file:\\d:\\music\\11.wma"));
}
public static void main(String[] args){
Player1 player1=new Player1();
player1.mp1.start();
}
}
it says that Cannot find a Player for :file:\d:\music\11.wma.what the
problem?
- 14
|
| Author |
Message |
Jan Li遝

|
Posted: 2004-2-16 17:41:00 |
Top |
java-programmer, How to kill thread which is blocked by Serversocket.accept()?
Hi;
I have got a network-thread running in the background listening for
connection-attempts.
The thread uses an instance of Serversocket and its accept() method to
listen.
After a certain period of time i want to kill the thread if no connection is
established.
The problem is: the accept-method blocks until someone connects.
Therefore it is not possible for me to use the interrupted-flag and check it
within a loop in my
thread to signalize it to end (the recommended way to kill a thread). I dont
want to use the thread.stop
() method since it is deprecated, but even when i try to use it i can not
kill the thread.
Within my gui thread i tried to use a swing timer, but it doesnt kill the
thread:
timer = new Timer(TEN_SECONDS, new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (networkThread.isAlive) {
timer.stop();
networkThread.stop();
//...Update the GUI...
}
}
Anybody there who knows a proper way of killing such a blocked thread?
Thanks in advance,
Jan
|
| |
|
| |
 |
Ryan Stewart

|
Posted: 2004-2-16 22:25:00 |
Top |
java-programmer >> How to kill thread which is blocked by Serversocket.accept()?
"Jan Li遝" <email***@***.com> wrote in message
news:c0q37g$19jcpa$email***@***.com...
> Hi;
> I have got a network-thread running in the background listening for
> connection-attempts.
> The thread uses an instance of Serversocket and its accept() method to
> listen.
> After a certain period of time i want to kill the thread if no connection
is
> established.
> The problem is: the accept-method blocks until someone connects.
> Therefore it is not possible for me to use the interrupted-flag and check
it
> within a loop in my
> thread to signalize it to end (the recommended way to kill a thread). I
dont
> want to use the thread.stop
> () method since it is deprecated, but even when i try to use it i can not
> kill the thread.
> Within my gui thread i tried to use a swing timer, but it doesnt kill the
> thread:
>
> timer = new Timer(TEN_SECONDS, new ActionListener() {
> public void actionPerformed(ActionEvent evt) {
> if (networkThread.isAlive) {
> timer.stop();
> networkThread.stop();
> //...Update the GUI...
> }
> }
>
> Anybody there who knows a proper way of killing such a blocked thread?
>
> Thanks in advance,
> Jan
>
Close the socket.
|
| |
|
| |
 |
John C. Bollinger

|
Posted: 2004-2-16 22:39:00 |
Top |
java-programmer >> How to kill thread which is blocked by Serversocket.accept()?
Jan Li遝 wrote:
> Hi;
> I have got a network-thread running in the background listening for
> connection-attempts.
> The thread uses an instance of Serversocket and its accept() method to
> listen.
> After a certain period of time i want to kill the thread if no connection is
> established.
> The problem is: the accept-method blocks until someone connects.
> Therefore it is not possible for me to use the interrupted-flag and check it
> within a loop in my
> thread to signalize it to end (the recommended way to kill a thread). I dont
> want to use the thread.stop
> () method since it is deprecated, but even when i try to use it i can not
> kill the thread.
> Within my gui thread i tried to use a swing timer, but it doesnt kill the
> thread:
>
> timer = new Timer(TEN_SECONDS, new ActionListener() {
> public void actionPerformed(ActionEvent evt) {
> if (networkThread.isAlive) {
> timer.stop();
> networkThread.stop();
> //...Update the GUI...
> }
> }
>
> Anybody there who knows a proper way of killing such a blocked thread?
I think you are going about it the hard way. If you read the API docs
for ServerSocket.accept(), you will see, among other things,
"Throws:
[...]
SocketTimeoutException - if a timeout was previously set with
setSoTimeout and the timeout has been reached."
That seems custom-made for precisely your problem. If you proceed to
read the docs for setSoTimeout then it seems even more so. Before
invoking accept(), then, set a timeout via setSoTimeout, and you
shouldn't need to worry about actively killing the accepting thread.
Moreover, you can trap the SocketTimeoutException and take appropriate
action in the thread that attempted to accept(), where you have
considerably more context with which to write log messages, retry, or
whatever else you might want to do.
John Bollinger
email***@***.com
|
| |
|
| |
 |
Thomas G. Marshall

|
Posted: 2004-2-18 12:41:00 |
Top |
java-programmer >> How to kill thread which is blocked by Serversocket.accept()?
Jan Li遝 <email***@***.com> coughed up the following:
> Hi;
> I have got a network-thread running in the background listening for
> connection-attempts.
> The thread uses an instance of Serversocket and its accept() method to
> listen.
> After a certain period of time i want to kill the thread if no
> connection is established.
> The problem is: the accept-method blocks until someone connects.
> Therefore it is not possible for me to use the interrupted-flag and
> check it within a loop in my
> thread to signalize it to end (the recommended way to kill a thread).
> I dont want to use the thread.stop
> () method since it is deprecated, but even when i try to use it i can
> not kill the thread.
> Within my gui thread i tried to use a swing timer, but it doesnt kill
> the thread:
>
> timer = new Timer(TEN_SECONDS, new ActionListener() {
> public void actionPerformed(ActionEvent evt) {
> if (networkThread.isAlive) {
> timer.stop();
> networkThread.stop();
> //...Update the GUI...
> }
> }
>
> Anybody there who knows a proper way of killing such a blocked thread?
>
> Thanks in advance,
> Jan
Perhaps.....
ServerSocket.accept() can throw an IOException. Check to see if one of the
IOExceptions thrown is actually InterruptedIOException (a subclass of
IOException). It's likely that /that/ will be thrown when somewhere else
Thread.interrupt() is called on the thread running the
ServerSocket.accept(). Basically, call accept() while catching all
exceptions. Then externally call theThread.interrupt(), and see if the
accept() unblocks. Perhaps that'd work----it's been a while since I've used
it.
Sorry, I'd have tested this out for you before posting right now, but my
eclipse install just exploded, so I thought it'd help to think aloud.
|
| |
|
| |
 |
Tony Morris

|
Posted: 2004-2-18 13:04:00 |
Top |
java-programmer >> How to kill thread which is blocked by Serversocket.accept()?
"Thomas G. Marshall" <email***@***.com>
wrote in message news:u1CYb.32339$email***@***.com...
> Jan Li遝 <email***@***.com> coughed up the following:
>
> > Hi;
> > I have got a network-thread running in the background listening for
> > connection-attempts.
> > The thread uses an instance of Serversocket and its accept() method to
> > listen.
> > After a certain period of time i want to kill the thread if no
> > connection is established.
> > The problem is: the accept-method blocks until someone connects.
> > Therefore it is not possible for me to use the interrupted-flag and
> > check it within a loop in my
> > thread to signalize it to end (the recommended way to kill a thread).
> > I dont want to use the thread.stop
> > () method since it is deprecated, but even when i try to use it i can
> > not kill the thread.
> > Within my gui thread i tried to use a swing timer, but it doesnt kill
> > the thread:
> >
> > timer = new Timer(TEN_SECONDS, new ActionListener() {
> > public void actionPerformed(ActionEvent evt) {
> > if (networkThread.isAlive) {
> > timer.stop();
> > networkThread.stop();
> > //...Update the GUI...
> > }
> > }
> >
> > Anybody there who knows a proper way of killing such a blocked thread?
> >
> > Thanks in advance,
> > Jan
>
> Perhaps.....
>
> ServerSocket.accept() can throw an IOException. Check to see if one of
the
> IOExceptions thrown is actually InterruptedIOException (a subclass of
> IOException). It's likely that /that/ will be thrown when somewhere else
> Thread.interrupt() is called on the thread running the
> ServerSocket.accept(). Basically, call accept() while catching all
> exceptions. Then externally call theThread.interrupt(), and see if the
> accept() unblocks. Perhaps that'd work----it's been a while since I've
used
> it.
>
> Sorry, I'd have tested this out for you before posting right now, but my
> eclipse install just exploded, so I thought it'd help to think aloud.
>
>
>
InterruptedException is not a subclass of IOException, which blows your
whole theory.
--
Tony Morris
(BInfTech, Cert 3 I.T.)
Software Engineer
(2003 VTR1000F)
Sun Certified Programmer for the Java 2 Platform (1.4)
Sun Certified Developer for the Java 2 Platform
|
| |
|
| |
 |
thoff

|
Posted: 2004-2-18 13:44:00 |
Top |
java-programmer >> How to kill thread which is blocked by Serversocket.accept()?
The way i've done it before is to:
1. set an is exit flag to true
2. check the exit flag after accept
3. have another thread make a connection so accept unblocks
Not sure if this is the most elegant java approach,
but it works.
|
| |
|
| |
 |
Thomas Schodt

|
Posted: 2004-2-18 14:34:00 |
Top |
java-programmer >> How to kill thread which is blocked by Serversocket.accept()?
Tony Morris wrote:
> "Thomas G. Marshall" <email***@***.com>
> wrote in message news:u1CYb.32339$email***@***.com...
>
>>
>>Perhaps.....
>>
>>ServerSocket.accept() can throw an IOException. Check to see if the
>>IOException thrown is actually InterruptedIOException (a subclass of
>>IOException). It's likely that /that/ will be thrown when somewhere else
>>Thread.interrupt() is called on the thread running the
>>ServerSocket.accept(). Basically, call accept() while catching all
>>exceptions. Then externally call theThread.interrupt(), and see if the
>>accept() unblocks. Perhaps that'd work----it's been a while since I've
>>used it.
>>
>>Sorry, I'd have tested this out for you before posting right now, but my
>>eclipse install just exploded, so I thought it'd help to think aloud.
>
> InterruptedException is not a subclass of IOException, which blows your
> whole theory.
I coded something like this recently, it took me a while to notice that
InterruptedException != InterruptedIOException
Anyhow, I found that Thread.interrupt() does not interrupt a socket
operation, so I had to use setSoTimeout() to interrupt the operation
periodically and then check Thread.currentThread().interrupted() to see
if another thread had called Thread.interrupt() on us.
|
| |
|
| |
 |
Ryan Stewart

|
Posted: 2004-2-18 21:02:00 |
Top |
java-programmer >> How to kill thread which is blocked by Serversocket.accept()?
"Tony Morris" <email***@***.com> wrote in message
news:c0urnt$dha$email***@***.com...
> "Thomas G. Marshall"
<email***@***.com>
> wrote in message news:u1CYb.32339$email***@***.com...
> > Jan Li遝 <email***@***.com> coughed up the following:
> >
> > > Hi;
> > > I have got a network-thread running in the background listening for
> > > connection-attempts.
> > > The thread uses an instance of Serversocket and its accept() method to
> > > listen.
> > > After a certain period of time i want to kill the thread if no
> > > connection is established.
> > > The problem is: the accept-method blocks until someone connects.
> > > Therefore it is not possible for me to use the interrupted-flag and
> > > check it within a loop in my
> > > thread to signalize it to end (the recommended way to kill a thread).
> > > I dont want to use the thread.stop
> > > () method since it is deprecated, but even when i try to use it i can
> > > not kill the thread.
> > > Within my gui thread i tried to use a swing timer, but it doesnt kill
> > > the thread:
> > >
> > > timer = new Timer(TEN_SECONDS, new ActionListener() {
> > > public void actionPerformed(ActionEvent evt) {
> > > if (networkThread.isAlive) {
> > > timer.stop();
> > > networkThread.stop();
> > > //...Update the GUI...
> > > }
> > > }
> > >
> > > Anybody there who knows a proper way of killing such a blocked thread?
> > >
> > > Thanks in advance,
> > > Jan
> >
> > Perhaps.....
> >
> > ServerSocket.accept() can throw an IOException. Check to see if one of
> the
> > IOExceptions thrown is actually InterruptedIOException (a subclass of
> > IOException). It's likely that /that/ will be thrown when somewhere
else
> > Thread.interrupt() is called on the thread running the
> > ServerSocket.accept(). Basically, call accept() while catching all
> > exceptions. Then externally call theThread.interrupt(), and see if the
> > accept() unblocks. Perhaps that'd work----it's been a while since I've
> used
> > it.
> >
> > Sorry, I'd have tested this out for you before posting right now, but my
> > eclipse install just exploded, so I thought it'd help to think aloud.
> >
> >
> >
>
> InterruptedException is not a subclass of IOException, which blows your
> whole theory.
>
Besides which, would Thread.interrupt() even work here? In the docs, it
seems to indicate that interrupt() will only work on I/O operations being
done by classes that implement java.nio.channels.InterruptibleChannel.
|
| |
|
| |
 |
Thomas G. Marshall

|
Posted: 2004-2-18 23:04:00 |
Top |
java-programmer >> How to kill thread which is blocked by Serversocket.accept()?
Tony Morris <email***@***.com> coughed up the following:
> "Thomas G. Marshall"
> <email***@***.com> wrote in
> message news:u1CYb.32339$email***@***.com...
...[thwack]...
>> Perhaps.....
>>
>> ServerSocket.accept() can throw an IOException. Check to see if one
>> of the IOExceptions thrown is actually InterruptedIOException (a
>> subclass of IOException). It's likely that /that/ will be thrown
>> when somewhere else Thread.interrupt() is called on the thread
>> running the ServerSocket.accept(). Basically, call accept() while
>> catching all exceptions. Then externally call
>> theThread.interrupt(), and see if the accept() unblocks. Perhaps
>> that'd work----it's been a while since I've used it.
>>
>> Sorry, I'd have tested this out for you before posting right now,
>> but my eclipse install just exploded, so I thought it'd help to
>> think aloud.
>>
>>
>>
>
> InterruptedException is not a subclass of IOException, which blows
> your whole theory.
>
> --
> Tony Morris
It turns out that the accept() is not interruptible from empirical evidence.
BUT regardless, you need to be more careful before you respond
contentiously. I *never* said anything about "InterruptedException". I
said "InterruptedIOException".
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
java.io.InterruptedIOException
|
| |
|
| |
 |
Thomas G. Marshall

|
Posted: 2004-2-18 23:07:00 |
Top |
java-programmer >> How to kill thread which is blocked by Serversocket.accept()?
Thomas Schodt" <"news04jan"@\"xenoc.demon.co.uk\
<"news04jan"@\"xenoc.demon.co.uk\"> coughed up the following:
> Tony Morris wrote:
>
>> "Thomas G. Marshall"
>> <email***@***.com> wrote in
>> message news:u1CYb.32339$email***@***.com...
>>
>>>
>>> Perhaps.....
>>>
>>> ServerSocket.accept() can throw an IOException. Check to see if the
>>> IOException thrown is actually InterruptedIOException (a subclass of
>>> IOException). It's likely that /that/ will be thrown when
>>> somewhere else Thread.interrupt() is called on the thread running
>>> the ServerSocket.accept(). Basically, call accept() while catching
>>> all exceptions. Then externally call theThread.interrupt(), and
>>> see if the accept() unblocks. Perhaps that'd work----it's been a
>>> while since I've used it.
>>>
>>> Sorry, I'd have tested this out for you before posting right now,
>>> but my eclipse install just exploded, so I thought it'd help to
>>> think aloud.
>>
>> InterruptedException is not a subclass of IOException, which blows
>> your whole theory.
>
> I coded something like this recently, it took me a while to notice
> that InterruptedException != InterruptedIOException
>
> Anyhow, I found that Thread.interrupt() does not interrupt a socket
> operation, so I had to use setSoTimeout() to interrupt the operation
> periodically and then check Thread.currentThread().interrupted() to
> see
> if another thread had called Thread.interrupt() on us.
Yeah, and that seems like a shame.
Dusting off some of the gears in me noggin, I remember asking an interview
candidate something similar to this back in the ugly 1.0 days. I *thought*
that interrupts worked on it from 1.1 on though....to much dust I suppose :)
|
| |
|
| |
 |
Thomas G. Marshall

|
Posted: 2004-2-18 23:27:00 |
Top |
java-programmer >> How to kill thread which is blocked by Serversocket.accept()?
Thomas Schodt" <"news04jan"@\"xenoc.demon.co.uk\
<"news04jan"@\"xenoc.demon.co.uk\"> coughed up the following:
...[rip]...
> Anyhow, I found that Thread.interrupt() does not interrupt a socket
> operation, so I had to use setSoTimeout() to interrupt the operation
> periodically and then check Thread.currentThread().interrupted() to
> see
> if another thread had called Thread.interrupt() on us.
Apparently there *might* be a resolution to this. Perhaps this is what I
remember.
In any case read this:
http://developer.java.sun.com/developer/bugParade/bugs/4107086.html
If you haven't registered, then the contents are here:
----------------[paste]----------------
Bug Id 4107086
Votes 1
Synopsis Thread.interrupt doesn't work on ServerSocket.accept
Category java:classes_net
Reported Against 1.2beta3
Release Fixed 1.2fcs
State Closed, fixed
Related Bugs
Submit Date Jan 27, 1998
Description: With Solaris green threads, Thread.interrupt on a thread that's
waiting in
ServerSocket.accept has no effect. With native threads, the wrong exception
is
thrown: a plain SocketException instead of InterruptedIOException.
With Solaris green threads, Thread.interrupt on a thread that's waiting in
ServerSocket.accept has no effect. With native threads, the wrong exception
is
thrown: a plain SocketException instead of InterruptedIOException. See the
attached test program.
Workaround None.
Evaluation: This was fixed with the thread interrupt changes that went in
for other bugs,
such as 4152799, 4159884, 4160579.
xxxxx@xxxxx 1998-10-22
Your Comments & Work-arounds
Include a link with my name & email
THU AUG 19 03:59 P.M. 1999
mgriffin2
This still seems to be a problem with
JDK-1.2.2-W, native threads, nojit
|
| |
|
| |
 |
Tony Morris

|
Posted: 2004-2-19 6:39:00 |
Top |
java-programmer >> How to kill thread which is blocked by Serversocket.accept()?
"Thomas G. Marshall" <email***@***.com>
wrote in message news:f9LYb.58650$email***@***.com...
> Tony Morris <email***@***.com> coughed up the following:
>
> > "Thomas G. Marshall"
> > <email***@***.com> wrote in
> > message news:u1CYb.32339$email***@***.com...
>
> ...[thwack]...
>
> >> Perhaps.....
> >>
> >> ServerSocket.accept() can throw an IOException. Check to see if one
> >> of the IOExceptions thrown is actually InterruptedIOException (a
> >> subclass of IOException). It's likely that /that/ will be thrown
> >> when somewhere else Thread.interrupt() is called on the thread
> >> running the ServerSocket.accept(). Basically, call accept() while
> >> catching all exceptions. Then externally call
> >> theThread.interrupt(), and see if the accept() unblocks. Perhaps
> >> that'd work----it's been a while since I've used it.
> >>
> >> Sorry, I'd have tested this out for you before posting right now,
> >> but my eclipse install just exploded, so I thought it'd help to
> >> think aloud.
> >>
> >>
> >>
> >
> > InterruptedException is not a subclass of IOException, which blows
> > your whole theory.
> >
> > --
> > Tony Morris
>
> It turns out that the accept() is not interruptible from empirical
evidence.
>
> BUT regardless, you need to be more careful before you respond
> contentiously. I *never* said anything about "InterruptedException". I
> said "InterruptedIOException".
>
> java.lang.Object
> java.lang.Throwable
> java.lang.Exception
> java.io.IOException
> java.io.InterruptedIOException
>
>
>
There was never any contention intended.
My apologies for the oversight.
--
Tony Morris
(BInfTech, Cert 3 I.T.)
Software Engineer
(2003 VTR1000F)
Sun Certified Programmer for the Java 2 Platform (1.4)
Sun Certified Developer for the Java 2 Platform
|
| |
|
| |
 |
Thomas G. Marshall

|
Posted: 2004-2-19 11:30:00 |
Top |
java-programmer >> How to kill thread which is blocked by Serversocket.accept()?
Tony Morris <email***@***.com> coughed up the following:
> "Thomas G. Marshall"
> <email***@***.com> wrote in
> message news:f9LYb.58650$email***@***.com...
>> Tony Morris <email***@***.com> coughed up the following:
>>
>>> "Thomas G. Marshall"
>>> <email***@***.com> wrote in
>>> message news:u1CYb.32339$email***@***.com...
>>
>> ...[thwack]...
>>
>>>> Perhaps.....
>>>>
>>>> ServerSocket.accept() can throw an IOException. Check to see if
>>>> one of the IOExceptions thrown is actually InterruptedIOException
>>>> (a subclass of IOException). It's likely that /that/ will be
>>>> thrown when somewhere else Thread.interrupt() is called on the
>>>> thread running the ServerSocket.accept(). Basically, call
>>>> accept() while catching all exceptions. Then externally call
>>>> theThread.interrupt(), and see if the accept() unblocks. Perhaps
>>>> that'd work----it's been a while since I've used it.
>>>>
>>>> Sorry, I'd have tested this out for you before posting right now,
>>>> but my eclipse install just exploded, so I thought it'd help to
>>>> think aloud.
>>>>
>>>>
>>>>
>>>
>>> InterruptedException is not a subclass of IOException, which blows
>>> your whole theory.
>>>
>>> --
>>> Tony Morris
>>
>> It turns out that the accept() is not interruptible from empirical
>> evidence.
>>
>> BUT regardless, you need to be more careful before you respond
>> contentiously. I *never* said anything about
>> "InterruptedException". I said "InterruptedIOException".
>>
>> java.lang.Object
>> java.lang.Throwable
>> java.lang.Exception
>> java.io.IOException
>> java.io.InterruptedIOException
>>
>>
>>
>
> There was never any contention intended.
> My apologies for the oversight.
>
> --
> Tony Morris
> (BInfTech, Cert 3 I.T.)
> Software Engineer
> (2003 VTR1000F)
> Sun Certified Programmer for the Java 2 Platform (1.4)
> Sun Certified Developer for the Java 2 Platform
Nice bike. Is the 2003 red? I have a white 1993 VFR-750F. A distant
cousin twice removed to the vtr.
When deciding which bike to buy in '93, it was between that and a zx-11, the
/then/ bad boy. I bought the VFR for its technology. A single-sided swing
arm that neatly comes down and grabs the wheel from one side. A 90 degree
V4. Gear driven cams that sound spectacular.
|
| |
|
| |
 |
Tony Morris

|
Posted: 2004-2-19 12:32:00 |
Top |
java-programmer >> How to kill thread which is blocked by Serversocket.accept()?
> Nice bike. Is the 2003 red? I have a white 1993 VFR-750F. A distant
> cousin twice removed to the vtr.
>
> When deciding which bike to buy in '93, it was between that and a zx-11,
the
> /then/ bad boy. I bought the VFR for its technology. A single-sided
swing
> arm that neatly comes down and grabs the wheel from one side. A 90 degree
> V4. Gear driven cams that sound spectacular.
>
>
Yep, it's red.
http://www.xdweb.net/~dibblego/vtr1000/
My girlfriend loves the look of the VFR800, however, she doesn't hold a
licence or the ability to ride a machine of that calibre (1.5 hours riding
experience) - perhaps another day in the future, we will own one.
--
Tony Morris
(BInfTech, Cert 3 I.T.)
Software Engineer
(2003 VTR1000F)
Sun Certified Programmer for the Java 2 Platform (1.4)
Sun Certified Developer for the Java 2 Platform
|
| |
|
| |
 |
Thomas G. Marshall

|
Posted: 2004-2-19 22:03:00 |
Top |
java-programmer >> How to kill thread which is blocked by Serversocket.accept()?
Tony Morris <email***@***.com> coughed up the following:
>> Nice bike. Is the 2003 red? I have a white 1993 VFR-750F. A
>> distant cousin twice removed to the vtr.
>>
>> When deciding which bike to buy in '93, it was between that and a
>> zx-11, the /then/ bad boy. I bought the VFR for its technology. A
>> single-sided swing arm that neatly comes down and grabs the wheel
>> from one side. A 90 degree V4. Gear driven cams that sound
>> spectacular.
>>
>>
>
> Yep, it's red.
> http://www.xdweb.net/~dibblego/vtr1000/
>
> My girlfriend loves the look of the VFR800, however, she doesn't hold
> a licence or the ability to ride a machine of that calibre (1.5 hours
> riding experience) - perhaps another day in the future, we will own
> one.
I've never been a believer in the big-bikes-need-experience thing. /Any/
bike will put you in the ground. A larger bike has a distinct advantage:
You are less likely to get that rut-rut-rut engine complaint by not suppling
enough gas in the wrong gear. But you're right in one respect: I was able
to semi-smoothly go from a standstill to riding speed entirely in 5th gear
on the zx-11, without feathering the crap out of the clutch. (!) It's one
of my tests. I can't imagine what would happen if my hand twitched in
5th...
Sorry guys for the OT. I'll stop.
|
| |
|
| |
 |
Tony Morris

|
Posted: 2004-2-20 6:12:00 |
Top |
java-programmer >> How to kill thread which is blocked by Serversocket.accept()?
"Thomas G. Marshall" <email***@***.com>
wrote in message news:9m3Zb.62133$email***@***.com...
> Tony Morris <email***@***.com> coughed up the following:
>
> >> Nice bike. Is the 2003 red? I have a white 1993 VFR-750F. A
> >> distant cousin twice removed to the vtr.
> >>
> >> When deciding which bike to buy in '93, it was between that and a
> >> zx-11, the /then/ bad boy. I bought the VFR for its technology. A
> >> single-sided swing arm that neatly comes down and grabs the wheel
> >> from one side. A 90 degree V4. Gear driven cams that sound
> >> spectacular.
> >>
> >>
> >
> > Yep, it's red.
> > http://www.xdweb.net/~dibblego/vtr1000/
> >
> > My girlfriend loves the look of the VFR800, however, she doesn't hold
> > a licence or the ability to ride a machine of that calibre (1.5 hours
> > riding experience) - perhaps another day in the future, we will own
> > one.
>
> I've never been a believer in the big-bikes-need-experience thing. /Any/
> bike will put you in the ground. A larger bike has a distinct advantage:
> You are less likely to get that rut-rut-rut engine complaint by not
suppling
> enough gas in the wrong gear. But you're right in one respect: I was able
> to semi-smoothly go from a standstill to riding speed entirely in 5th gear
> on the zx-11, without feathering the crap out of the clutch. (!) It's
one
> of my tests. I can't imagine what would happen if my hand twitched in
> 5th...
>
> Sorry guys for the OT. I'll stop.
>
>
I feel the same way - but the thought of my girlfriend on a 200kg+ bike
tends to put me off a bit.
I grew up on dirt bikes, and I reckon it's the best way to learn, though I
try to be open-minded about alternatives.
In contrast, the thought of my girlfriend getting on a YZ125 brings less
confidence than a VFR800 - too many times, I've seen a learner drop the
clutch at high engine speed only to land on their butt !
It's going to be a slow process, but if she wants a VFR800, I want to be
confident that she's capable, and right now, I'm not.
--
Tony Morris
(BInfTech, Cert 3 I.T.)
Software Engineer
(2003 VTR1000F)
Sun Certified Programmer for the Java 2 Platform (1.4)
Sun Certified Developer for the Java 2 Platform
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- JMF on pocket pcI wrote an application for my iPAQ, and use JMF cross-platform
version, with Jeode, to playback a file.wav, but when the application
starts, the console shows these errors :
at com.sun.media.renderer.audio.JavaSoundRenderer.initDevice()
at com.sun.media.renderer.audio.JavaSoundRenderer.open()
at com.sun.media.BasicRendererModule.doPrefetch()
at com.sun.media.BasicTrackControl.prefetchTrack()
at com.sun.media.PlaybackEngine.doPrefetch1()
at com.sun.media.PlaybackEngine.doPrefetch()
at com.sun.media.PrefetchWorkThread.process()
at com.sun.media.StateTransitionWorkThread.run()
Why???
- 2
- awt Dialog color problemHi, I'm using jdk 1.1.8 on an embedded application which runs under Personal
Java on VxWorks (I think). But anyway, that may not matter. I'm displaying
an awt Dialog and the color of the title bar is a pretty ordinary looking
red. I'm guessing this comes from O/S like it would in MS Windows. I have
no access to the operating system to change this. Is there any way to
change system colours in java?
Chris.
- 3
- Dying hype: Slowing sales of iPhone
Well, the hype sure died fast. For those morons who think 700k units
were sold over the weekend - hey idiots, that's an ESTIMATE from one
source, and the most generous one at that. The range of sales
estimates is from 250k to 700k.
In fact, some analysts have downgraded sales projections for next year
from 12 m to 8 million based on the fact that supply seemed to be more
than demand.
think about it morons. ur selling 8 million phones in a 1 BILLION unit
yearly market.
* laughing at the macnut tools who spent lots of money on a smudgy
underwhelming toy (so far), enjoying the nice breeze too
- 4
- UML Eclipse PluginDoes anyone know a Eclipse plugin that generates a UML diagram out of java code
Thanks
Felix
- 5
- Easy way to display JSP source on webI need an easy way to display JSP source in a
web page.
If I use..
<jsp:include page="/test/index.jsp" ></jsp:include> or
<%@ include file="/test/index.jsp" %>
..the jsp I want to include is merged with the
original page and (usually) throws exceptions.
Is there any way to include a jsp in a web page
but have it treated as if it were text?
- 6
- GCJ 4.1 and OpenOffice.orgFWIW, I have been working with Eric Anholt to have Kaffe (java/kaffe)
supported by bsd.java.mk. The only thing with miss is a port of a
Javadoc tool so that ports documentation may be built without any Sun or
IBM JDK. I believe gjdoc (can't remember if this part of classpath or
another "free" Java tool) could be used in place of javadoc.
I'll have a look at your wrapper and modifications in the next few days.
Herve
On Fri, Mar 10, 2006 at 10:59:35AM +0900, NAKATA Maho wrote:
> I believe gcj is now one of the usable Java implementation,
> however there are some small (but tedious) issues must be solved to
> check in to FBSD ports cvs repo.
> I made some ports or updates of ports so that we can at least compile a
> package using Java; OpenOffice.org. I believe with appropreate wrapper,
> we can add gnugcj as _JAVA_VENDOR_LIST in /usr/ports/Mk/bsd.java.mk.
> then we can use/comple Java applications without bootstrapping java/jdk14
> etc.
- 7
- loading varablesI have a variable "book" which askes the user for four titles which will be
with one patron's name.
How would i load this with a loop?
Some how I am getting lost?
Thank you.
input Patron's name
name = reader.readLine("Enter the first patron's name: ");
patron.setName(p);
for (int i = 1; i <= 3; i++){
Book = reader.readLine("Enter the book's title: ");
Book.setBook(i, Book);
- 8
- Non-blocking method for reading writing objects to socketsThe methods writeObject and readObject of socket class are blocking
one. i.e. if we create a ObjectInputStream object using
new ObjectInputStream(socket.getInputStream()), the methods blocks
until it gets some stream stuff.
What is the corresponding non-blocking mthod so as to include in
non-blocking programming?
- 9
- Which executable is used to run Java applets ?When a webpage attempts to run an applet, which executable on my
computer gets launched? Is it "java.exe"?
My reason for this question is that my browser (Mozilla 1.4)
apparently doesn't offer the option to refuse to run Java applets.
So I searched for every occurrence of "java.exe" on my hard-drive
and renamed all of them to something else.
I even re-booted the computer afterwards and then cleared
the browser's cache.
When I went back to a website that runs applets, it took a while
but finally did run the applet, as evidenced by that
familiar coffee-cup icon in the system tray.
So could it be that "java.exe" is not the executable called to run
Java applets? If not, which one would it be?
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
- 10
- cult3d e javaHo compilato un java per usarlo con cult3d ma quando lo chiamo dal cult mi
ritorna questo errore:
java.lang.NoClassDefFoundError
at com/ms/security/SecurityClassLoader.internalDefineClass
at com/ms/security/SecurityClassLoader.defineClass
at com/cult3d/IECult3DClassLoader.loadClass
at com/cult3d/IECult3DMain.event
Succede lo stesso anche se provo a compilare un esempio base di cult, a
questo punto penso di dover cambiare qualcosa nella procedura di
compilazione.
Qualcuno ha gia' sbattuto la testa contro questo errore?
- 11
- Seeing if a string equals NullHow can you test a string to see if it is null? I have tried the
following code but it throws a nullpointerexception.
for (int i = 0; i < names.length; ++i) {
if (names[i].equals("null")) {
nullcount += 1;
}
- 12
- errors within constructorHi I am working on a project and I am getting an error that I do not
understand.
I have the part of the code below along with the line that gives error.
From the exception message I can assume that the object I pass to the
HashMap is a null object but in the code below I create a new object and
initialize it.
I appreciate any advice.
// group IP address
private static final String MULTGRP = "225.4.5.6";
private InetAddress group = InetAddress.getByName(MULTGRP);
private static HashMap mapGroupSocket = null;
// constructor
public IRCServer()throws IOException{
// create sockets for all groups.
MulticastSocket mcastCsci5431 = new MulticastSocket(CSCI5431_PORT);
mcastCsci5431.joinGroup(group);
// other code (not relevant)
mapGroupSocket.put(CSCI5431, mcastCsci5431); <---- exception
thrown.
}
Error:
Exception in thread "main" java.lang.NullPointerException
at IRCServer.<init>(IRCServer.java:91)
at IRCServer.main(IRCServer.java:105)
- 13
- To wrap or not to wrap?Hi,
In my personal development efforts, I frequently wrap basic java
functionality. For example, I have a
String MyIO.urlToString(String url)
or
byte[] MIO.urlToBytes(String url)
etc. These functions catch exceptions and return null if something
goes wrong. I have other functoins that, for example, load database
queries into maps.
My gereneral questions are these. Does everybody pretty much end up
writing convenience wrappers like these for themselves?. If yes, why
aren't utilities like these commonly available as more or less
standard libraries? And if no - why not? Is it a bad idea to use these
and is it for some reason better to, e.g., always form URL's, open
connections, capture exceptions, etc.
Thanks for your opinions!
Aaron
- 14
- JBoss startup exceptionsI am getting exceptions when starting the JBoss server. I believe I
have set the environment up correctly. The webserver brings up the
homepage but I can't get to the jmx-console. Has anyone else had this
problem and is there something obvious I've missed?
I'm running on tru64 unix 4.0f with JDK1.4.2. Trying to install jboss
4.0.2
- 15
- newbie scrollbar questionI have a JTextArea wrapped in a JScrollPane, and when I append a line
to the text area
I want the scroll bar to adjust so that the new line is seen in the
viewport. I have
some code that seems to work most of the time, but every once in a
while it does
not work properly. I think I'm probably not doing this the right way.
Here's a code
snippet that shows what I'm doing:
JPanel consolePane = new JPanel();
JTextArea consoleTextArea = new JTextArea(35, 65);
JScrollPane consoleScrollPane = new JScrollPane(consoleTextArea);
JScrollBar vsb = consoleScrollPane.getVerticalScrollBar();
When I want to update the text I do this:
consoleTextArea.append(line);
consoleTextArea.append("\n");
vsb.setMaximum(vsb.getMaximum()+1);
vsb.setValue(vsb.getMaximum()+1);
Seems like there must be an easier way to do this. Is there some
attribute that
I can set that will make this happen automagically?
TIA!
-larry
|
|
|