| Kill a thread automatically |
|
 |
Index ‹ java-programmer
|
- Previous
- 3
- JTabbedPane selection changesHello,
I couldn't find what would be the was to go to detect changes in a
JTabbedPane's selection...?
Can anyone give a hint please?
Karsten
- 3
- database search using LuceneI need example for database search using Lucene.
I found many example Lucene with file but not on Database please guide
me
Thanks...
- 3
- JUnit RemoteTestRunner ErrorHi. I was running a test suite under JUnit version 3.7.0 through
XDE/Eclipse version 2.0.1 and I got a null pointer error. When I
stepped through the program, I saw that the error occurs right when I
get a window telling me
that "org.eclipse.jdt.runner.RemoteTestRunner" type cannot be found.
Do I need this type? It does not seem to be in the junit.jar file.
Thanks for any info,
Ken
- 3
- Detecting compiler version at runtimeThis is a multipart message in MIME format.
Does anyone know if there is a way to determine which version of the
compiler was used. That is, at runtime - using 1.4.x - finding
out if the class/jar was compiled with 1.3.x?
Thanks
<br><font size=1 face="sans-serif">Does anyone know if there is a way to determine which version of the compiler was used. That is, at runtime - using 1.4.x - finding</font>
<br><font size=1 face="sans-serif">out if the class/jar was compiled with 1.3.x?</font>
<br>
<br><font size=1 face="sans-serif">Thanks</font>
<br>
<br>
- 3
- Accessing a method inside of an object that is stored in a vector...I have been trying to post to .help all day but nothing is going
through. Will try it here and hope it does....
I am trying to access a getData() method that simply returns a stored
integer value from an object that is stored in a vector. I have tried
to do this but cannot get the notation correct. I tried google groups
and the only thing I got from there was to pull the object from the
vector into a temperary object. That didnt work.
So, here is the code I have so far of making the temp object and
making sure it is actually pulling one out. I still connot figure out
how to access the getData() method.
Any hints are appreciated.
import java.util.Vector;
public class StackUser
{
public static void main(String argv[])
{
Vector vector = new Vector();
for (int i = 0; i < 100; i++)
vector.add(i, new StackNode());
System.out.println(vector.get(0));
Object tobj = vector.get(0);
System.out.println(tobj);
}
}
public class StackNode
{
private int value = 0;
public StackNode()
{
value = (int)(Math.random());
}
public int getData()
{
return value;
}
}
- 4
- Fake Odm Watches Unpretentious Cheap - Odm Watches Unpretentious Watch FakeFake Odm Watches Unpretentious Cheap - Odm Watches Unpretentious Watch
Fake
Fake Watches Home : http://www.watchesprice.net/
Fake Odm Brands : http://www.watchesprice.net/Odm-Watches.html
Fake Odm Watches Unpretentious : http://www.watchesprice.net/Odm-Watches-Unpretentious-Watches.html
Fake Odm Watches Unpretentious --- We are glad to offer you the best
Odm Watches Unpretentious Fake at a very moderate price. All these
timepieces are very bright and in style, select one for yourself or
for your beloved person.
Fake Odm Watches Unpretentious, full lines of this brand you can find
at our store, we offer wide range of brand name watch Fakes, these
fake watches are copied in high quality, yet in reasonable price.
Odm Watches Unpretentious All Products :
ODM Men's Watches Unpretentious SU23-3 - AA :
http://www.watchesprice.net/ODM-Mens-Watches-Unpretentious-SU23-3-AA-11713.html
ODM Men's Watches Unpretentious SU23A-6 :
http://www.watchesprice.net/ODM-Mens-Watches-Unpretentious-SU23A-6-11714.html
Odm Su23-4 Unpretentious Ll Mens Watch :
http://www.watchesprice.net/Odm-Su23-4-Unpretentious-Ll-Mens-Watch-11715.html
Odm Su23a-1 Unpretentious Ll Mens Watch :
http://www.watchesprice.net/Odm-Su23a-1-Unpretentious-Ll-Mens-Watch-11716.html
Odm Su23a-2 Unpretentious Ll Mens Watch :
http://www.watchesprice.net/Odm-Su23a-2-Unpretentious-Ll-Mens-Watch-11717.html
Odm Su23a-5 Unpretentious Ll Mens Watch :
http://www.watchesprice.net/Odm-Su23a-5-Unpretentious-Ll-Mens-Watch-11718.html
Odm Su53-1 Unpretentious 3 Mens Watch :
http://www.watchesprice.net/Odm-Su53-1-Unpretentious-3-Mens-Watch-11719.html
Odm Su53-2 Unpretentious 3 Mens Watch :
http://www.watchesprice.net/Odm-Su53-2-Unpretentious-3-Mens-Watch-11720.html
ODM Men's Watches Unerring III SU53-3 :
http://www.watchesprice.net/ODM-Mens-Watches-Unerring-III-SU53-3-11721.html
The Same Odm
Odm Never Too Late To Action : http://www.watchesprice.net/Odm-Never-Too-Late-To-Action-Watches.html
Odm Watches 3 Touch : http://www.watchesprice.net/Odm-Watches-3-Touch-Watches.html
Odm Watches Adventurous : http://www.watchesprice.net/Odm-Watches-Adventurous-Watches.html
Odm Watches Born for Clubbing : http://www.watchesprice.net/Odm-Watches-Born-for-Clubbing-Watches.html
Odm Watches Camouflage : http://www.watchesprice.net/Odm-Watches-Camouflage-Watches.html
Odm Watches Dragon : http://www.watchesprice.net/Odm-Watches-Dragon-Watches.html
Odm Watches Forever Lolita : http://www.watchesprice.net/Odm-Watches-Forever-Lolita-Watches.html
Odm Watches Link : http://www.watchesprice.net/Odm-Watches-Link-Watches.html
Odm Watches Luxury : http://www.watchesprice.net/Odm-Watches-Luxury-Watches.html
Odm Watches Mr. Metallic : http://www.watchesprice.net/Odm-Watches-Mr-Metallic-Watches.html
Odm Watches Mysterious V : http://www.watchesprice.net/Odm-Watches-Mysterious-V-Watches.html
Odm Watches No Fear In Dark : http://www.watchesprice.net/Odm-Watches-No-Fear-In-Dark-Watches.html
Odm Watches Out : http://www.watchesprice.net/Odm-Watches-Out-Watches.html
Odm Watches Pixel : http://www.watchesprice.net/Odm-Watches-Pixel-Watches.html
Odm Watches Speed : http://www.watchesprice.net/Odm-Watches-Speed-Watches.html
Odm Watches Spin : http://www.watchesprice.net/Odm-Watches-Spin-Watches.html
Odm Watches Sport : http://www.watchesprice.net/Odm-Watches-Sport-Watches.html
Odm Watches Symbol : http://www.watchesprice.net/Odm-Watches-Symbol-Watches.html
Odm Watches To Be Cool : http://www.watchesprice.net/Odm-Watches-To-Be-Cool-Watches.html
Odm Watches To Be Young : http://www.watchesprice.net/Odm-Watches-To-Be-Young-Watches.html
Odm Watches Uncompromising : http://www.watchesprice.net/Odm-Watches-Uncompromising-Watches.html
Odm Watches Unerring II : http://www.watchesprice.net/Odm-Watches-Unerring-II-Watches.html
Odm Watches Unit : http://www.watchesprice.net/Odm-Watches-Unit-Watches.html
Odm Watches Unpretentious : http://www.watchesprice.net/Odm-Watches-Unpretentious-Watches.html
Odm Watches Urban Warriors United :
http://www.watchesprice.net/Odm-Watches-Urban-Warriors-United-Watches.html
Odm Watches We Will Rock You : http://www.watchesprice.net/Odm-Watches-We-Will-Rock-You-Watches.html
Odm Watches World Peace : http://www.watchesprice.net/Odm-Watches-World-Peace-Watches.html
Odm Watches Zen : http://www.watchesprice.net/Odm-Watches-Zen-Watches.html
Geneva print is made by the Geneva law in 1886. Geneva law intended
to protect the real production of watches in Geneva, so as to avoid
other inferior Odm Watches Unpretentious products marked with Geneva
made being sold. So far, it has been revised several times to meet
the changes of the times. The watches which comply with the standards
movement watches will be eligible for Geneva imprin, the print is
carved Marker in Geneva emblem of the 'hawks' and 'key'. Geneva law
requirment of each part of the movement should be to made in
accordance with established rules and regulations exactly, although
some parts may be purely decorative, but can fully reveal the watches
totally dependent on artificial completed. Odm Watches Unpretentious
For example, all acute angle must be cut into slope, further
polishing; and Cyclovirobuxine gear is decorated artificially and
polished with wood. The rule was made to remove all inferior products
to ensure each one watches are completed in the best crafsmanship and
materials. Today, this rule has become the guarantee of making watches
in highest crafsmanship. Early watches manufacturers to prove the
accuracy of its products usually have their Odm Watches Unpretentious
and clocks be identified by the official observatory , then all
Observatory in Europe, including London, Paris, Geneva watches
manufacturing center had such service. Later watches manufactures
slowly moved to Geneva, official Observatory in Geneva could not load
all the works. In order to promote their products, Switzerland
goverment set up a full-time official of the test center called Sw iss
O ffic ia lCh ron om e te r Te s tin gAu-th or ity (COSC), by Sw iss
Ca lib ra tion Se rv ice of th e Sw iss Fed e ra lMe tro logy Bu reau
(SCS) has proved its impartiality. Watches tested by the COSC called
CH RONOM ETER (The Table), Odm Watches Unpretentious every one of the
movement have independent code and supporting documents, on behalf of
certain of its accuracy. <br> In watches making craftsmanship,
Observatory watches can be said to be pursuing a not bad ever extreme
realm. Error of Mechanical watch a day is 15 seconds, the Observatory
watches particularly emphasize movement, material and craftsmanship,
error a day at -4 to +6 seconds and the quartz watch is strictly
controled in the + / -0. within two seconds.
- 7
- Any Source Code or Web site demonstrate the effect of gridwidth and gridheigh of GridBaglayoutDear all,
I want to make clear how the outlook of Gridbaglayout will
change according to different value of gridwidth and gridheight of
GridBagConstraints. Please suggest some source code for me so that I
can modify the source code of the value of gridheight and gridwidth,
thus I can find out the change of the outlook according to different
value of gridheight and gridwidth. Or please suggest some website for
me to investigate about the gridwidth and gridheight of
GridBagConstraints.
Thanks.
- 10
- no applicationshi guys
ive installed the jdk on my xp system
it will run applets, but when i try to run
an application i get the following
message in the command prompt window
'Exception in thread "main" java.lang.NoClassDefFoundError:'
the same programs work fine on the collage system, so
it shouldn't be the code
please help
pat
- 10
- Java applets and client-side ssl certificates?Applet Gurus,
Is anybody out there doing Java applets and client-side ssl certificates?
When I turn the requirement on in Apache, I get handshake failure errors
when the applet tries to load. Certificates are installed in the web
browser for the user's html browsing.
Some of our customers are on locked down machines that don't allow
"installation of software" but they jave jre 1.4.2 and Java Web Start.
Considering using Java Network Launch Protocol (JNLP) or some other kind
of applet based install but I think this would require a signed applet.
This, in turn, would require a certificate to be installed beforehand
(to validate the signed jar). Since our certs are all done in-house,
I'm in a chicken/egg situation. All certificates are issued by an
internal CA but are not easy to get for various reasons.
Is there an easy way to mass-install certificates (to keystores) in a
secure way without touching all the workstations?
The applet/client-side certificates present four problems as I see it:
1 handling the user's certificate securely
2 Maintainig the internal CA and root certs
3 Excessive prompting for multiple passwords to keystores
4 Keystore security (Bouncy Castle libs are 1MB)
Does anyone have any advice to give?
Thanks
Chuck
- 11
- ports/83434: www/jakarta-tomcat ports give the wrong ownershipOld Synopsis: tomcat ports give the wrong ownership to their installed executables
New Synopsis: www/jakarta-tomcat ports give the wrong ownership to their installed executables
State-Changed-From-To: feedback->open
State-Changed-By: hq
State-Changed-When: Tue Oct 18 15:44:20 GMT 2005
State-Changed-Why:
Timeout
Responsible-Changed-From-To: freebsd-java->hq
Responsible-Changed-By: hq
Responsible-Changed-When: Tue Oct 18 15:44:20 GMT 2005
Responsible-Changed-Why:
I'll handle this.
This is the last improvement to be applied to www/jakarta-tomcat55 before we
merge back all recent improvements into other Tomcat ports.
http://www.freebsd.org/cgi/query-pr.cgi?pr=83434
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 12
- [OT] Any way to see if a website is up in an automated way?I am looking for a tool or technique that can automatically check to see if
a specific website is up - say twice a day - and then send me an email if it
isn't. I do not want to have to manually check myself.
Does anyone know of a way to do this?
I have no money to spend on this so if there is no free service that does
it, I'd be interested in how I can program this, preferably in Java. I
assume that my best bet would be Java application that I could schedule via
Windows XP scheduler but I can code applets and servlets too if that makes
more sense.
--
Rhino
- 13
- java tablesI'm writing an API and i'd like some help testing it.
The API is designed to allow developers to create feature rich tables both
server and client side.
- 13
- dynamic file download with *long* response time - How to show "Save As" early?I've got a Java servlet that delivers large database resultsets
transformed to Excel with the HSSF library. In some cases it takes
more than 15 minutes before transformation is done and content can be
delivered to the browser.
I want to show the "Save As" dialog as early as possible so the user
knows he's not lost and forgotten.
I already tried to send the response headers immediately after
receiving the request including content disposition and filename. Even
though the browser receives those headers it just won't trigger the
"Save As" dialog. This applies to both MS IE and Mozilla.
Any ideas appreciated.
- 15
- poi hssf getCellStyle problemhey there,
i have a big problem with those cellstyles. i want to add background
color to some cells, but apparently i just can "change" cell styles
from cells which already "have one".
for better understanding of my problem, here's the code:
for ( int i = 0; i <= rowcount; i++ ) {
for (int j = 0; j <= colcount; j++) {
HSSFRow row = s1.getRow((short)i);
if (row != null) {
HSSFCell cell = row.getCell((short)j);
if (cell != null) {
HSSFCellStyle style = cell.getCellStyle();
style.setFont(font);
style.setWrapText(true);
style.setFillForegroundColor(colorIndex);
if ( (j%4== 0) && (colorIndex ==
HSSFColor.LIGHT_CORNFLOWER_BLUE.index) ) {
colorIndex = HSSFColor.LEMON_CHIFFON.index;
}
else if ( (j%4== 0) && (colorIndex ==
HSSFColor.LEMON_CHIFFON.index) ) {
colorIndex =
HSSFColor.LIGHT_CORNFLOWER_BLUE.index;
}
}
}
}
}
}
this piece of code just works for cells, which already have attributes
in their cell styles like background color and border. cells which
just have a border and no color won't get the instructed color...
does anybody know what to do? is the method cell.getCellStyle() not
the best option in this case?
best regards and thx in advance,
manuela
- 15
- Spring Framework for Java/J2EE/.NET Application development...
Hello all
I'm very pleased to announce the launch of www.SpringHub.com : a
one-stop information resource dedicated to the Spring Framework for
Java/J2EE/.NET application development.
SpringHub.com provides free, easy and fast access to hundreds of Spring
Framework resources organized in several categories and sub-categories:
- Spring Quick Start (Spring Framework Project, Spring Reference
Documentation, Spring Terminology, Spring Tutorials, Sample Book
Chapters)
- Spring InfoSources (Spring Articles, Spring Presentations, Spring
Blogs, Spring Wikis, Spring Interviews, Spring News)
- Spring Products (Spring Related Projects, Spring Libraries/Plugins,
Spring Tools, Spring Books, Miscellaneous)
- Spring Services (Spring Consulting, Spring Trainings, Spring Courses,
Spring Jobs)
- Spring Usage (Sample Applications/Code, Real-World Usage)
- Community Support (Spring Forums, Spring Mailing Lists, Spring User
Groups, Spring FAQs)
- Related Frameworks (Meta-Frameworks, IoC Frameworks, AOP Frameworks,
Front-End, Business Logic, Back-End, RIA Frameworks, Testing
Frameworks)
- Related Resources (Sun Official Resources, Java IDEs, Open Source
Stacks, Web Servers, Web Containers, Application Servers,View
Technologies, Remoting and Web Services)
With your feedback and URL submissions, SpringHub.com will evolve to
better serve you and the fast growing Spring Framework community.
Regards,
Slim Baltagi
J2EE Consultant
Chicago, USA
http://www.SpringHub.com
|
| Author |
Message |
Adi Schwarz

|
Posted: 2004-1-30 22:40:00 |
Top |
java-programmer, Kill a thread automatically
Hi,
If I have a class that runs a thread and no reference points to it, the
gc won't finalize the class because the thread is still running -> so
stopping the thread in the finalize() method won't work. Afaik this is
also true for daemon threads.
Is it possible to stop a thread automatically when there are no
references left? In my case it does not matter if the thread is
gracefully interrupted or just killed and whiped out.
greets,
-adi
|
| |
|
| |
 |
Niki Estner

|
Posted: 2004-1-30 23:01:00 |
Top |
java-programmer >> Kill a thread automatically
Couldn't you create some class that encapsulates your thread; All the code
outside the thread uses references to this wrapper object, but the thread
itself has no reference (or only weak ones) to its wrapper. If the wrapper
gets finalized, it could kill the thread. (I didn't really think this
through, but I guess it should work)
Niki
"Adi Schwarz" <email***@***.com> wrote in
news:bvdqac$r0bqf$email***@***.com...
> Hi,
>
> If I have a class that runs a thread and no reference points to it, the
> gc won't finalize the class because the thread is still running -> so
> stopping the thread in the finalize() method won't work. Afaik this is
> also true for daemon threads.
>
> Is it possible to stop a thread automatically when there are no
> references left? In my case it does not matter if the thread is
> gracefully interrupted or just killed and whiped out.
>
> greets,
> -adi
>
|
| |
|
| |
 |
Chris Smith

|
Posted: 2004-1-30 23:02:00 |
Top |
java-programmer >> Kill a thread automatically
Adi Schwarz wrote:
> If I have a class that runs a thread and no reference points to it, the
> gc won't finalize the class because the thread is still running -> so
> stopping the thread in the finalize() method won't work. Afaik this is
> also true for daemon threads.
>
> Is it possible to stop a thread automatically when there are no
> references left? In my case it does not matter if the thread is
> gracefully interrupted or just killed and whiped out.
No, this is not possible. You're going to have to manage access to the
thread and explicitly signal it to finish when no one is interested in
the work it's doing.
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
|
| |
|
| |
 |
Adi Schwarz

|
Posted: 2004-1-30 23:23:00 |
Top |
java-programmer >> Kill a thread automatically
Niki Estner wrote:
> Couldn't you create some class that encapsulates your thread; All the code
> outside the thread uses references to this wrapper object, but the thread
> itself has no reference (or only weak ones) to its wrapper. If the wrapper
> gets finalized, it could kill the thread. (I didn't really think this
> through, but I guess it should work)
thanks for the hint to weak references!
-as
|
| |
|
| |
 |
Bryan Bullard

|
Posted: 2004-1-31 0:29:00 |
Top |
java-programmer >> Kill a thread automatically
"Adi Schwarz" <email***@***.com> wrote in message
news:bvdqac$r0bqf$email***@***.com...
> Hi,
>
> If I have a class that runs a thread and no reference points to it, the
> gc won't finalize the class because the thread is still running -> so
> stopping the thread in the finalize() method won't work. Afaik this is
> also true for daemon threads.
>
> Is it possible to stop a thread automatically when there are no
> references left?
yes, just let the thread end normally (e.g., when Thread.run() returns).
if this is completely impractical, you might need to rethink your design.
>In my case it does not matter if the thread is
> gracefully interrupted or just killed and whiped out.
>
> greets,
> -adi
>
|
| |
|
| |
 |
Robert Olofsson

|
Posted: 2004-1-31 4:37:00 |
Top |
java-programmer >> Kill a thread automatically
Niki Estner <email***@***.com> wrote:
: Couldn't you create some class that encapsulates your thread; All the code
: outside the thread uses references to this wrapper object, but the thread
: itself has no reference (or only weak ones) to its wrapper. If the wrapper
: gets finalized, it could kill the thread. (I didn't really think this
: through, but I guess it should work)
This wont work.
Threads have references to them, the ThreadGroup they are part of will
still have a reference. Since you have a reference to the thread it
wont die until you tell it to or it exits the run method.
This means that you will have to store the thread somewhere so that
you can kill it if needed.
/robo
|
| |
|
| |
 |
Niki Estner

|
Posted: 2004-1-31 6:18:00 |
Top |
java-programmer >> Kill a thread automatically
"Robert Olofsson" <email***@***.com> wrote in
news:bvef9n$2th$email***@***.com...
> Niki Estner <email***@***.com> wrote:
> : Couldn't you create some class that encapsulates your thread; All the
code
> : outside the thread uses references to this wrapper object, but the
thread
> : itself has no reference (or only weak ones) to its wrapper. If the
wrapper
> : gets finalized, it could kill the thread. (I didn't really think this
> : through, but I guess it should work)
>
> This wont work.
> Threads have references to them, the ThreadGroup they are part of will
> still have a reference. Since you have a reference to the thread it
> wont die until you tell it to or it exits the run method.
I guess you didn't read my post, did you?
Of course there is a reference to the Thread object as long as the thread is
running.
But if the thread doesn't have a reference to its wrapper object (or only a
weak reference), the wrapper object will be destroyed by the GC like any
other object, too. Now, the wrapper object can kill the thread (or tell it
to exit) when it's finalize method gets called.
> This means that you will have to store the thread somewhere so that
> you can kill it if needed.
Of course. The wrapper object must contain a reference to the thread object,
so it can kill it in the Finalize method.
>
> /robo
|
| |
|
| |
 |
Tony Morris

|
Posted: 2004-1-31 16:29:00 |
Top |
java-programmer >> Kill a thread automatically
"Adi Schwarz" <email***@***.com> wrote in message
news:bvdqac$r0bqf$email***@***.com...
> Hi,
>
> If I have a class that runs a thread and no reference points to it, the
> gc won't finalize the class because the thread is still running -> so
> stopping the thread in the finalize() method won't work. Afaik this is
> also true for daemon threads.
>
> Is it possible to stop a thread automatically when there are no
> references left? In my case it does not matter if the thread is
> gracefully interrupted or just killed and whiped out.
>
> greets,
> -adi
>
Relying on a call to finalize() is bad practice, since it not guaranteed
that the call will occur.
It is guaranteed that the call will occur if the object is garbage
collected, but the object is not guaranteed to be garbage collected.
Threads cease execution at the end of the run() method. You can interrupt()
a Thread if it is in a state where an interrupt might occur (generally sleep
state), although there's a bit more to it than just that - I suggest you
read the threads tutorial. Forcefully terminating a Thread with stop() is
deprecated for good reason.
http://java.sun.com/docs/books/tutorial/essential/threads/
That might clarify it a bit.
--
Tony Morris
(BInfTech, Cert 3 I.T., SCJP[1.4], SCJD)
Software Engineer
IBM Australia - Tivoli Security Software
Home : +61 7 5502 7987
Work : +61 7 5552 4076
Mobile : 0408 711 099
(2003 VTR1000F)
|
| |
|
| |
 |
sgmanohar

|
Posted: 2004-2-1 8:06:00 |
Top |
java-programmer >> Kill a thread automatically
"Tony Morris" <email***@***.com> wrote in message news:<401b6734$0$3128$email***@***.com>...
> "Adi Schwarz" <email***@***.com> wrote in message
> news:bvdqac$r0bqf$email***@***.com...
> > Hi,
> >
> > If I have a class that runs a thread and no reference points to it, the
> > gc won't finalize the class because the thread is still running -> so
> > stopping the thread in the finalize() method won't work. Afaik this is
> > also true for daemon threads.
> >
> > Is it possible to stop a thread automatically when there are no
> > references left? In my case it does not matter if the thread is
> > gracefully interrupted or just killed and whiped out.
> >
> > greets,
> > -adi
> >
>
If there were an automatic way of doing this, it would be pretty
dangerous!
I think the best way to do this is for the thread itself to stop
itself by returning from the run() method. Somewhere in the thread's
loop, it should check a flag, and die if needed.
Perhaps, each time you create or drop a reference to the thread, you
could increment or decrement a counter?
|
| |
|
| |
 |
John C. Bollinger

|
Posted: 2004-2-3 5:22:00 |
Top |
java-programmer >> Kill a thread automatically
Niki Estner wrote:
> "Robert Olofsson" <email***@***.com> wrote in
> news:bvef9n$2th$email***@***.com...
>
>>Niki Estner <email***@***.com> wrote:
>>: Couldn't you create some class that encapsulates your thread; All the
>
> code
>
>>: outside the thread uses references to this wrapper object, but the
>
> thread
>
>>: itself has no reference (or only weak ones) to its wrapper. If the
>
> wrapper
>
>>: gets finalized, it could kill the thread. (I didn't really think this
>>: through, but I guess it should work)
>>
>>This wont work.
>>Threads have references to them, the ThreadGroup they are part of will
>>still have a reference. Since you have a reference to the thread it
>>wont die until you tell it to or it exits the run method.
>
>
> I guess you didn't read my post, did you?
> Of course there is a reference to the Thread object as long as the thread is
> running.
> But if the thread doesn't have a reference to its wrapper object (or only a
> weak reference), the wrapper object will be destroyed by the GC like any
> other object, too. Now, the wrapper object can kill the thread (or tell it
> to exit) when it's finalize method gets called.
>
>
>>This means that you will have to store the thread somewhere so that
>>you can kill it if needed.
>
>
> Of course. The wrapper object must contain a reference to the thread object,
> so it can kill it in the Finalize method.
Except you cannot count on any object's finalize method _ever_ being
invoked. You can certainly create an object that knows how to terminate
the thread, but you still have to explicitly tell it to do so -- in
other words, your suggestion just pushes the problem up one level.
John Bollinger
email***@***.com
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- tcpmon loggingHi all,
I find the tcpmon utility from apache.org very useful. But is there
any way to make the tcpmon to log the http request + response into
local file instead of just displaying at the GUI, so it is easier for
me to trace later?
Thank you.
Best regards,
John
- 2
- How to convert int/float etc into byte[]?For example
int i = 2;
char c = 'c';
float f = (float)3.45;
double d = 3.546;
String s = "Hello";
I want to write all these into a binary file.
In OutputStream, PrintStream classes
they have
write(int byte); and
write(byte[] buffer, int offset, int length);
My question is how do I convert those i,c,f,d,s into
byte[]?
Thank Q in advance!
- 3
- Connection PooledI want to use connection pool just like those mensioned in the following
link but for MSSQL
and MySQL. Do I have to depend on the vendor package?
http://www.lc.leidenuniv.nl/awcourse/oracle/java.920/a96654/connpoca.htm#1057365
SK
- 4
- OpenCMS help!I'm trying to install OpenCMS with MS SqlServer.
Then i have error:
javax.servlet.ServletException: OpenCms initialization error!
Could not connect to the database. Is the database up and running?
at com.opencms.core.OpenCmsHttpServlet.init(OpenCmsHttpServlet.java:245)
......
I'm checking MS SqlServer database is running.
What happen about it?
Can everyone help me now?
Thank before!
- 5
- Ant testing jar for differences
Hi,
I'm trying to implement this logic in an Ant build script:
1) Put all .class files into a new tempLatestBuild.jar
2) If HASH(tempLatestBuild.jar) != HASH(
previousLatestBuild.jar) replace...
I've done this with web.xml and various other config files,
but jars change everytime (even though the .class and MANIFEST.MF file
do not).
With the <jar> task, the MANIFEST.MF timestamp was different
every time in the resultant jar.... So I changed it to a <zip> task
and copied in the MANIFEST.MF by hand.
This fixed the timestamp issue, but there are still two bytes
difference, and I can't see what they are. All the flags on the files
look ok (examined in winzip and when unzipped).
Has anyone done this kind of thing?
Cheers,
- 6
- A similar problemHi,
I get a similar stack except that the exception is a ServletException.
I can't figure this out at all. Here's the field validation declaration
that I am trying to use.
<field property="clientaPlannedRetirementAge" depends="validwhen"
page="1">
<arg position="0"
key="lnra.clienta.clientaPlannedRetirementAge"/>
<var>
<var-name>test</var-name>
<var-value>(clientaExpectedAgeAtDeath >90)</var-value>
</var>
</field>
Does anyone have any clues as to what this might be?
Thanks
[ERROR] ServletException raised in AuthorizationFilter:
javax.servlet.ServletException: antlr/TokenStream
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:143)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at
com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java:333)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at
com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1166)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:676)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:203)
at
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062)
at
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
at
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
at
org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at
com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at
com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:76)
at
com.amfam.needsanalysis.authorization.AuthorizationFilter.doFilter(AuthorizationFilter.java:82)
at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
at
org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:182)
at
com.amfam.internalsso.AmfamSecurityFilter.doFilter(AmfamSecurityFilter.java:115)
at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1162)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:676)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:203)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:300)
at
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at
com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:120)
at
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:250)
at
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:652)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:458)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:936)
- [AuthorizationFilter]
- 7
- Java symbol confusionHi there,
I started learning myself java a while ago and there's still loads of
concepts and things about the java language i don't know, so i may just
make an arse of myself now...
I use the NetBeans 5.0 IDE to play around with. Sometimes it does
things that I think (from what I've learned about java) that it
shouldn't do. I may just be stupid or something, so could somebody
point out my faults. Here's a piece of code:
import java.net.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
try {
ServerSocket serverSocket = new ServerSocket(56);
}catch (IOException e) {System.out.println("Daar was kak in die
konneksie...");}
Socket clientSocket = null;
<<------------------------------------
clientSocket = serverSocket.accept();
<<------------------------------------
}
}
Ok that's just part of it. I'm still learning how to do the rest. Ok,
my first problem here is that when the two lines marked with arrows
above is out of the try-catch block, NetBeans tells me it can't find
the symbol serverSocket. On the other hand, when I put the two marked
lines inside of the try-catch block, it works without a problem. Can
someone explain to me why this is happening??
===========WORKING=============
try {
ServerSocket serverSocket = new ServerSocket(56);
Socket clientSocket = null;
clientSocket = serverSocket.accept();
}catch (IOException e) {System.out.println("Daar was kak in die
konneksie...");}
===========NOT WORKING=============
try {
ServerSocket serverSocket = new ServerSocket(56);
}catch (IOException e) {System.out.println("Daar was kak in die
konneksie...");}
Socket clientSocket = null;
clientSocket = serverSocket.accept();
It says:
C:\Documents and
Settings\Constant\netServer\src\netserver\Main.java:22: cannot find
symbol
symbol : variable serverSocket
location: class Main
clientSocket = serverSocket.accept();
1 error
BUILD FAILED (total time: 0 seconds)
- 8
- How do I receive SOAP Messages via HTTP from an App?Hi,
I have a Java Application. It is both a socket server and a socket
client. I can run the app on multiple computers and they can connect to
each other.
I can create SOAPMessages and use a SOAPConnection to send these
messages to listening sockets on the other computers.
I'm having trouble taking the received SOAP message as a byte stream
and converting it to a Java SOAPMessage.
How should I do this?
I think I need an HTTP Server. Is this correct? Is there one included
in the J2SE or J2EE classes?
Thanks!
John
- 9
- "standards" for tooltips?All,
I'm working on a large Swing app. which has inconsistent use of
tooltips. In fact I have to address a bug report complaining about the
inconsistencies of the tooltips. Some of our widgets display "helpful
text" as tooltips, others display the full details on the chosen value
(e.g. full pathname of a file chosen) etc.
Is there any documented standard for how best to use tooltips?
TIA,
Sean
- 10
- FreeBSD Java porting project questionsHi all.
I have some questions about this freebsd port.
1)Why we need linux jdk, when building a native distr?
Is that necesarily to build compiler with classes semultaneusly?
2)What are you think about java (and of course jdk) future on freebsd.
I saw freebsdfoundations last message dated last year, and nothing more.
Doesnt project stop or going to?
Thanks for all answers. I really interesting about this
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 11
- Tomcat can't find antRun scriptI've been developing a web site on XP and deploying it on Unix (Solaris)
using
Tomcat 4.0.6 on the Unix box.
In the last deployment of my class files, I also moved some jar files to
$TOMCAT/common/lib
and made some changed to server.xml to implemnet connection pooling.
Now Tomcat won't compile a JSP page giving the message:
Cannot locate antRun script: property 'ant.home' not found.
I can't figure out what I broke. Can anyone tell me where this
ant.home property should be set and and/or where antRun should
live? I (believe) I have restored the server.xml and jar files to their
originals but I still have the problem.
I appreciate your help in getting me un-stuck.
jim cant
- 12
- how to send formatted text like in chat programeshello ,
i would like rto ask how to send formatted text, like italic , font
size, blah blah
from one computer clientt o client like chat programes , i l know to
send plain text, i their ways to send formatted text , i think may be
html format but i need more solution please...
islam
- 13
- MQ Series messages browse and deleteHi,
I am writing an MQ client that should get messages from MQ Queue one
by one and then delete it in case of successful processing.
As documented in MQ Series Programming Guide a queue should be opened
for browsing and removing. For browsing an option
MQGMO_BROWSE_FIRST or MQGMO_BROWSE_NEXT should be used and for
deleting MQGMO_BROWSE_MSG_UNDER_CURSOR.
Browsing works fine for me but delete does not - all messages remain
in a queue.
Thanks
Following is a code fragment:
.................
try {
mQMgr = new MQQueueManager(remoteQManager);
int openInputOptions = MQC.MQOO_FAIL_IF_QUIESCING |
MQC.MQOO_INPUT_SHARED | MQC.MQOO_BROWSE;
outputQueue=mQMgr.accessQueue(remoteQueue, openInputOptions);
MQMessage retrievedMessage = new MQMessage();
MQGetMessageOptions gmo=new MQGetMessageOptions();
gmo.options=MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_FIRST;
gmo.matchOptions=MQC.MQMO_NONE;
gmo.waitInterval=10000;
while(true) {
if(c>0) { gmo.options = MQC.MQGMO_WAIT |
MQC.MQGMO_BROWSE_NEXT; }
outputQueue.get(retrievedMessage, gmo);
msg=retrievedMessage.readString(retrievedMessage.getMessageLength());
System.out.println("************************ message "+c+"
********************** " + retrievedMessage.persistence);
System.out.println("RETRIEVED MESSAGE: "+msg);
System.out.println("REMOVING
.................................");
gmo.options = MQC.MQGMO_WAIT |
MQC.MQGMO_BROWSE_MSG_UNDER_CURSOR;
outputQueue.get(retrievedMessage, gmo);
c++;
}
} catch (MQException mqe) {
if(mqe.reasonCode == mqe.MQRC_NO_MSG_AVAILABLE) {
System.out.println("NO MORE MESSAGES AVAILABLE, RETRIEVED
"+c);
return;
}
mqe.printStackTrace();
} catch (java.io.IOException ioe) {
ioe.printStackTrace(System.out);
return;
} finally {
try {
System.out.println("CLOSING A QUEUE & MANAGER");
if(outputQueue != null) { outputQueue.close(); }
if(mQMgr != null) { mQMgr.disconnect(); }
}
catch (MQException ex) {
ex.printStackTrace();
}
}
- 14
- Closing sockets and streams?If I have a socket and an InputStream and OutputStream that I have
opened from that socket, do I need to close the streams when I am
finished if I close the socket?
--
Knute Johnson
email s/nospam/knute/
- 15
|
|
|