No subject
Sat Nov 12 19:29:10 PST 2005
************
public Date(int year,
int month,
int date)
Deprecated. As of JDK version 1.1, replaced by Calendar.set(year + 1900,
month, date) or GregorianCalendar(year + 1900, month, date).
Allocates a Date object and initializes it so that it represents midnight,
local time, at the beginning of the day specified by the year, month, and
date arguments.
Parameters:
year - the year minus 1900.
month - the month between 0-11.
date - the day of the month between 1-31.
************
Look at the comment for 'year' parameter...
-- Ernest
-----Original Message-----
From: Vijesh Shetty [mailto:vijesh5 at hotmail.com]
Sent: Monday, November 27, 2000 12:00 PM
To: advanced-java at xcf.berkeley.edu
Subject: Help with Calendar
Hi All,
I am trying to find from a given date eg 2000-09-11,what day of week
it is (mon,tue..etc).
Calendar c = Calendar.getInstance() ;
c.setTime(new Date(2000,11,21));
The value I get when I do calender.get(Calendar.DAY_OF_WEEK) always
gives me a wrong answer..Here for the above eg it should have been Tuesday,
but this gives me the result as "Thursday"
Can anybody suggest me what is wrong here or provide me an alternative way?
regards
Vijesh
>From: advanced-java at egroups.com
>Reply-To: advanced-java at egroups.com
>To: advanced-java at egroups.com
>Subject: [advanced-java] Digest Number 348
>Date: 27 Nov 2000 11:37:01 -0000
>
>-------------------------- eGroups Sponsor -------------------------~-~>
>Create your business web site your way now at Bigstep.com.
>It's the fast, easy way to get online, to promote your business,
>and to sell your products and services. Try Bigstep.com now.
>http://click.egroups.com/1/9183/0/_/968/_/975325021/
>---------------------------------------------------------------------_->
>
>There are 25 messages in this issue.
>
>Topics in this digest:
>
> 1. Why the thread with lower priority did not run at all?
> From: Shilong Yao <tomadvancedjava at china.com>
> 2. About thread
> From: Shilong Yao <tomadvancedjava at china.com>
> 3. The threads slow down :(
> From: Shilong Yao <tomadvancedjava at china.com>
> 4. RE: RMI & Servlet
> From: "Mishkin, Ernest" <ernest.Mishkin at qwest.com>
> 5. RE: RMI & Servlet
> From: Li Bing <bing.li at asu.edu>
> 6. RE: Why the thread with lower priority did not run at all?
> From: "Stuart Halloway" <stu at develop.com>
> 7. RE: RMI & Servlet
> From: Li Bing <bing.li at asu.edu>
> 8. RE: RMI & Servlet
> From: "Mishkin, Ernest" <ernest.Mishkin at qwest.com>
> 9. RE: RMI & Servlet
> From: Li Bing <bing.li at asu.edu>
> 10. Rollback Exception
> From: Xiaoying Bai <xiaoying.bai at asu.edu>
> 11. Re: The threads slow down :(
> From: John Lusk <jlusk4 at yahoo.com>
> 12. Re: EJB Object implementation
> From: <debapriya.ghosh at processbiz.co.in>
> 13. java - SOAP
> From: "Akhil Nagpal" <ankul at neuralmagic.com>
> 14. RE: Can I regard a "thread" as a "control flow"?
> From: Kaj Bjurman <kaj.bjurman at aktiesparinvest.se>
> 15. RE: The threads slow down :(
> From: Kaj Bjurman <kaj.bjurman at aktiesparinvest.se>
> 16. RE: J2EE Pattern
> From: "Wathen, Dave" <dave.wathen at gs.com>
> 17. how to close a server socket, if there is no request from client
>for a period of time
> From: Rajesh Jumde <rj at aitpl.stpn.soft.net>
> 18. Re: how to close a server socket, if there is no request from
>client for a period of time
> From: Nicholas Wright <nick at ist.co.uk>
> 19. Re: J2EE Pattern
> From: YErkan at ddsi.ie
> 20. Re: Sending PDF from servlet
> From: Mariana <mariana at cstdev.cst.ro>
> 21. Re: how to close a server socket, if there is no request from
>client for a period of time
> From: "Gokul Singh" <gokul.singh at wipro.com>
> 22. [Q] JTable not showing properly
> From: "Chang Chao" <2chao at home.com>
> 23. Is pointer assignment Atomic?
> From: SAI VENKATESH <sai at nestec.net>
> 24. Re: [Q] JTable not showing properly
> From: "Aisling" <aisling at creator.co.za>
> 25. diff between green and native threads
> From: Khem Chand Sachdeva <ksuchdeva at npi.stpn.soft.net>
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 1
> Date: Sun, 26 Nov 2000 21:29:40 +0800
> From: Shilong Yao <tomadvancedjava at china.com>
>Subject: Why the thread with lower priority did not run at all?
>
>Dear All,
>See the program :
>/////////////////////////////////////////////////////////////////////////
>class Counter extends Thread {
> int id;
> long ii=0;
> public Counter(int idd) {
> id =idd; ii=0;
> if (idd==3) this.setPriority(this.getPriority()-1);
> start();
> }
> public void run() {
> System.out.print(id);
> System.out.println(" thread running");
> while (true) {
> this.yield();
> ii++;
> }
> }
> public void p() {System.out.print(" *");System.out.print(ii);};
>}
>public class Count extends Thread {
> int nr = 5;
> Counter c[] = new Counter[nr];
> public Count() {}
> public void run() {
> for (int i=0; i<nr; i++)
> c[i]=new Counter(i);
> long begin = System.currentTimeMillis();
> long curr, span;
> while (true) {
> curr = System.currentTimeMillis();
> span = curr -begin;
> if (span >= 20000) break;
> this.yield();
> }
> System.out.print("Span=");
> System.out.println(span);
> System.out.print("ActiveThreadCount=");
> System.out.println(Thread.activeCount());
> for (int i=0; i<nr; i++) {c[i].p();c[i].stop();}
> System.out.println();
> }
> public static void main(String args[]) {
> Count cc = new Count();
> cc.start();
> }
>}
>/////////////////////////////////////////////////////////////////////////
>The result is :
>0 thread running
>1 thread running
>2 thread running
>4 thread running
>Span=20000
>ActiveThreadCount=7
> *743938 *743938 *743938 *0 *743938
>
>QUESTION:
>Every thread is a counter.
>Yes I reduce the priority of the No.3 thread by 1. But it should count
>number anyway thought it may count more slowly. But why it was not
>scheduled by the scheduler? You see in the result, there is no sentense
>"3 thread running"???
>
> Shilong Yao
> tomadvancedjava at china.com
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 2
> Date: Sun, 26 Nov 2000 22:1:5 +0800
> From: Shilong Yao <tomadvancedjava at china.com>
>Subject: About thread
>
>Dear Mr.John,
>
>Thank you for help!
>Yes I know the difference between "Thread" and "thread". I just confirm
>whether a thread is a control flow. You said "yes". Thank you.
>
>Is a Dialog born with a control flow (I mean the message dispatcher)?
>And that control flow must be a UI thread, right?
>What about a ComboBox then? What kind of UI components are born with
>a message dispatcher thread?
>
>Another question :)
>/////////////////////////////////////////////////////////////////////////
>class Counter extends Thread {
> long ii=0;
> public Counter() { start(); }
> public void run() {
> while (true) {
> this.yield();
> ii++;
> }
> }
> public void p() {System.out.print(" *");System.out.print(ii);};
>}
>public class Count extends Thread {
> int nr = 5;
> Counter c[] = new Counter[nr];
> public Count() {}
> public void run() {
> for (int i=0; i<nr; i++)
> c[i]=new Counter(i);
> long begin = System.currentTimeMillis();
> long curr, span;
> while (true) {
> curr = System.currentTimeMillis();
> span = curr -begin;
> if (span >= 20000) break;
> this.yield();
> }
> System.out.print("Span=");
> System.out.println(span);
> System.out.print("ActiveThreadCount=");
> System.out.println(Thread.activeCount());
> for (int i=0; i<nr; i++) {c[i].p();c[i].stop();}
> System.out.println();
> }
> public static void main(String args[]) {
> Count cc = new Count();
> cc.start();
> }
>}
>/////////////////////////////////////////////////////////////////////////
>The result is :
>Span=20000
>ActiveThreadCount=7
> *743938 *743938 *743938 *0 *743938
>///////////////////////////////////
>In cc.run() I created 5 threads (nr=5) and cc is the 6th thread.
>But why ActiveThreadCount=7?
>Who is the 7th thread, then?
>
>Thank you.
>
>Yours,
>tom
> >There are two concepts labelled with the word "thread".
>
> >A capital-T Thread is a Java object with data and methods, but no life
> >of its own. Don't be confused by the presence of start() and run()
> >methods.
>
> >A lower-case-t thread is a control flow, as you said. Such a thread
> >is created by the Thread.start() method.
>
> >John.
>
> Shilong Yao
> tomadvancedjava at china.com
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 3
> Date: Sun, 26 Nov 2000 22:40:25 +0800
> From: Shilong Yao <tomadvancedjava at china.com>
>Subject: The threads slow down :(
>
>Dear All,
>See the following example:
>/////////////////////////////////////////////////////////////////////////
>class Counter extends Thread {
> int id;
> long ii=0;
> public Counter(int idd) {
> id =idd; ii=0;
> start();
> }
> public void run() {
> System.out.print(id);
> System.out.println(" thread running");
> while (true) {
> this.yield();
> ii++;
> }
> }
> public void p() {System.out.print(" *");System.out.print(ii);};
>}
>public class Count extends Thread {
> int nr = 5;
> Counter c[] = new Counter[nr];
> public Count() {}
> public void run() {
> for (int i=0; i<nr; i++)
> c[i]=new Counter(i);
> long begin = System.currentTimeMillis();
> long curr, span;
> while (true) {
> curr = System.currentTimeMillis();
> span = curr -begin;
> if (span >= 20000) break;
> this.yield();
> }
> System.out.print("Time Span=");
> System.out.println(span);
> System.out.print("ActiveThreadCount=");
> System.out.println(Thread.activeCount());
> for (int i=0; i<nr; i++) {c[i].p();c[i].stop();}
> System.out.println();
> }
> public static void main(String args[]) {
> Count cc = new Count();
> cc.start();
> }
>}
>/////////////////////////////////////////////////////////////////////////
>The result is :
>0 thread running
>1 thread running
>2 thread running
>4 thread running
>TimeSpan=20000
>ActiveThreadCount=7
> *743938 *743938 *743938 *0 *743938
>
>======================================
>I altered "nr" and let it be from 1 to 18. Thus the total number of active
>threads
>is from 3 to 20. From the number that had been counted by the Counter
>objects we
>can determine how many time units did every Counter thread got in 20
>seconds.
>From the result, we can see all the Counter thread counted the same number.
>That
>is to say the time slice was shared alike amoung the threads. Then I draw a
>chart
>whose x-axis represents the number of the total active threads and y-axis
>represents
>the time units each thread got. It turned out to be like the function
>y=exp(-x).
>The time units each thread got run down sharply as the number of total
>threads
>goes up.
>The conclusion is that the time resource of a java application is a fixed
>value.
>If the number of the running thread in the application increase, every
>thread runs
>more and more slowly. Is there any method can help prevent the thread from
>slowing
>down when the number of the running threads increase?
> Shilong Yao
> tomadvancedjava at china.com
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 4
> Date: Sun, 26 Nov 2000 10:57:52 -0500
> From: "Mishkin, Ernest" <ernest.Mishkin at qwest.com>
>Subject: RE: RMI & Servlet
>
>RMI URLs look like //hostname:port/BoundName (no "rmi://" in front).
>Also, check JavaSoft's RMI home page (http://www.javasoft.com/products/rmi)
>- a lot of beginners' questions are answered there.
>
>-- Ernest
>
>-----Original Message-----
>From: Li Bing
>To: Li Bing; Java_Help; Java; Java; Advanced-Java
>Sent: 11/26/00 4:15 AM
>Subject: RE: RMI & Servlet
>
>Hi, All,
>
>I think it's the URL definition probelm.
>
>When the JSDK2.1 is started, the URL = "rmi://localhost" won't work.
>
>How can I modify it? The JSDK2.1 uses http://localhost:8080. Are there
>any
>conflicts between them?
>
>Thanks!
>Bing
>
>-----Original Message-----
>From: Li Bing [mailto:bing.li at asu.edu]
>Sent: Sunday, November 26, 2000 1:47 AM
>To: Java_Help; Java; Java; Advanced-Java
>Subject: RMI & Servlet
>
>
>Dear All,
>
>I am trying to use RMI and Servlet. I can use a RMI client to run the
>methods on the RMI server. Can I replace the RMI client with a servlet?
>I
>mean the servlet can run the methods on the RMI server. Thus, I can put
>the
>result on the browser. I tried but failed. I just put the RMI client
>into
>the servlet as follows. Are there something wrong?
>
>By the way, I use JSDK2.1 as my servlet developing tool.
>
>Thanks!
>Bing
>
>import java.rmi.*;
>import java.rmi.server.*;
>import java.sql.Connection;
>import java.io.*;
>
>import javax.servlet.*;
>import javax.servlet.http.*;
>import java.text.*;
>import java.util.*;
>
>public class DBOpServlet extends HttpServlet
>{
> public void doPost(HttpServletRequest request,
>HttpServletResponse
>response)
> throws ServletException, IOException
> {
> System.setSecurityManager(new RMISecurityManager());
> String url = "rmi://localhost/";
>
> .....
> .....
>
> try
> {
> DBOperations cop8 =
>(DBOperations)Naming.lookup(url
>+ "FindStudentByCourseID");
> DBOperations cop15 =
>(DBOperations)Naming.lookup(url
>+ "Quit");
>
> rs = cop8.FindStudentByCourseID(id);
> cop15.Quit();
> }
> catch(Exception e)
> {
> System.out.println("Error " + e);
> }
>
> .....
> .....
>
> response.setContentType("text/html"); // content type
> PrintWriter responseOutput = response.getWriter();
> StringBuffer buf = new StringBuffer();
> buf.append( "<html>\n" );
> buf.append( "<title>Thank you!</title>\n" );
> buf.append( "Thank you for registering.\n" );
> buf.append( "<BR>ID:\n<PRE>" );
> buf.append( "<BR>------------<BR>" );
> buf.append( rs );
> buf.append( "</PRE>\n</html>" );
> responseOutput.println( buf.toString() );
> responseOutput.close();
> }
>}
>
>
>Thanks,
>Bing
>
> CSE, ASU __...----------------..._ ____________
> _.--~~~~~~~~~~~~~~~-.\~~~~~~~~\~-._ _____|| `
> ___ _.-~ 480-965-1746 (O) ~\\_ __ `\ ~-. _.-~`\
> \_-~ 480-965-9038 (L) ___\___/ )\_/-~ `\
> .-~~ ~~~------------------~~~~~ _.--._..--~~ \ /~\|
> .~/ // _-~ _ `\. | /\\ |
> / |___ 480-829-8492 (H) ______.~ /_\ | | |/ ||'
>|` \ |_bing.li at asu.edu_/ _-~ /~\\' | _/ |)=||
>| ~-_|________________/_.-~ // || |_..-~ |\ ||
>.. __________ \/ ____________ /()= || __./\\//
> \(_)\_______) (_________/(_) / \\ ||__..--~~~ ~~~~~~
> `-._________________________..--' \___//~
> `------`--' `---------' - Li Bing
> www.public.asu.edu/~libing
>
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 5
> Date: Sun, 26 Nov 2000 09:52:25 -0700
> From: Li Bing <bing.li at asu.edu>
>Subject: RE: RMI & Servlet
>
>Dear Ernest,
>
>Actually, I can use rmi://localhost if running the RMI client seperately.
>But after I need to combine the RMI and Servlet together in this way, the
>RMI server can be connected. Why?
>
>Thanks,
>Bing
>
>-----Original Message-----
>From: Mishkin, Ernest [mailto:ernest.Mishkin at qwest.com]
>Sent: Sunday, November 26, 2000 8:58 AM
>To: 'Li Bing '; 'Java_Help '; 'Java '; 'Java '; 'Advanced-Java '
>Subject: RE: RMI & Servlet
>
>
>RMI URLs look like //hostname:port/BoundName (no "rmi://" in front).
>Also, check JavaSoft's RMI home page (http://www.javasoft.com/products/rmi)
>- a lot of beginners' questions are answered there.
>
>-- Ernest
>
>-----Original Message-----
>From: Li Bing
>To: Li Bing; Java_Help; Java; Java; Advanced-Java
>Sent: 11/26/00 4:15 AM
>Subject: RE: RMI & Servlet
>
>Hi, All,
>
>I think it's the URL definition probelm.
>
>When the JSDK2.1 is started, the URL = "rmi://localhost" won't work.
>
>How can I modify it? The JSDK2.1 uses http://localhost:8080. Are there
>any
>conflicts between them?
>
>Thanks!
>Bing
>
>-----Original Message-----
>From: Li Bing [mailto:bing.li at asu.edu]
>Sent: Sunday, November 26, 2000 1:47 AM
>To: Java_Help; Java; Java; Advanced-Java
>Subject: RMI & Servlet
>
>
>Dear All,
>
>I am trying to use RMI and Servlet. I can use a RMI client to run the
>methods on the RMI server. Can I replace the RMI client with a servlet?
>I
>mean the servlet can run the methods on the RMI server. Thus, I can put
>the
>result on the browser. I tried but failed. I just put the RMI client
>into
>the servlet as follows. Are there something wrong?
>
>By the way, I use JSDK2.1 as my servlet developing tool.
>
>Thanks!
>Bing
>
>import java.rmi.*;
>import java.rmi.server.*;
>import java.sql.Connection;
>import java.io.*;
>
>import javax.servlet.*;
>import javax.servlet.http.*;
>import java.text.*;
>import java.util.*;
>
>public class DBOpServlet extends HttpServlet
>{
> public void doPost(HttpServletRequest request,
>HttpServletResponse
>response)
> throws ServletException, IOException
> {
> System.setSecurityManager(new RMISecurityManager());
> String url = "rmi://localhost/";
>
> .....
> .....
>
> try
> {
> DBOperations cop8 =
>(DBOperations)Naming.lookup(url
>+ "FindStudentByCourseID");
> DBOperations cop15 =
>(DBOperations)Naming.lookup(url
>+ "Quit");
>
> rs = cop8.FindStudentByCourseID(id);
> cop15.Quit();
> }
> catch(Exception e)
> {
> System.out.println("Error " + e);
> }
>
> .....
> .....
>
> response.setContentType("text/html"); // content type
> PrintWriter responseOutput = response.getWriter();
> StringBuffer buf = new StringBuffer();
> buf.append( "<html>\n" );
> buf.append( "<title>Thank you!</title>\n" );
> buf.append( "Thank you for registering.\n" );
> buf.append( "<BR>ID:\n<PRE>" );
> buf.append( "<BR>------------<BR>" );
> buf.append( rs );
> buf.append( "</PRE>\n</html>" );
> responseOutput.println( buf.toString() );
> responseOutput.close();
> }
>}
>
>
>Thanks,
>Bing
>
> CSE, ASU __...----------------..._ ____________
> _.--~~~~~~~~~~~~~~~-.\~~~~~~~~\~-._ _____|| `
> ___ _.-~ 480-965-1746 (O) ~\\_ __ `\ ~-. _.-~`\
> \_-~ 480-965-9038 (L) ___\___/ )\_/-~ `\
> .-~~ ~~~------------------~~~~~ _.--._..--~~ \ /~\|
> .~/ // _-~ _ `\. | /\\ |
> / |___ 480-829-8492 (H) ______.~ /_\ | | |/ ||'
>|` \ |_bing.li at asu.edu_/ _-~ /~\\' | _/ |)=||
>| ~-_|________________/_.-~ // || |_..-~ |\ ||
>.. __________ \/ ____________ /()= || __./\\//
> \(_)\_______) (_________/(_) / \\ ||__..--~~~ ~~~~~~
> `-._________________________..--' \___//~
> `------`--' `---------' - Li Bing
> www.public.asu.edu/~libing
>
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 6
> Date: Sun, 26 Nov 2000 12:35:55 -0500
> From: "Stuart Halloway" <stu at develop.com>
>Subject: RE: Why the thread with lower priority did not run at all?
>
>Java makes no guarantees about how a virtual machine will handle threads
>with different priorities, beyond "some effort" to give higher priority
>threads more chance to run. It is perfectly legal to write a VM that
>ignores priority entirely. It is also perfectly legal to write a VM that
>_never_ lets a low priority thread run when a higher priority thread is
>available, even if the higher priority thread calls yield.
>
>Never, ever use priority to try to cause things to happen in a certain
>order, or even happen at all. If you want to coordinate among threads, you
>need to use wait/notify/notifyAll, or interrupt, or some other signaling
>mechanism. The only use for thread priority is as a performance
>optimization for already-working code, or in rare cases as a workaround for
>a VM bug.
>
>Stuart Halloway
>DevelopMentor
>http://staff.develop.com/halloway
>
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 7
> Date: Sun, 26 Nov 2000 10:48:10 -0700
> From: Li Bing <bing.li at asu.edu>
>Subject: RE: RMI & Servlet
>
>Dear All,
>
>I got a question on RMI & Servlet when doing my project of Java class.
>
>I am trying to use RMI and Servlet. I can use a RMI client to run the
>methods on the RMI server. Can I replace the RMI client with a servlet? I
>mean the servlet can run the methods on the RMI server. Thus, I can put the
>result on the browser. I tried but failed. I just put the RMI client into
>the servlet as follows. Are there something wrong?
>
>By the way, I use JSDK2.1 as my servlet developing tool.
>
>Actually, I can use rmi://localhost if running the RMI client seperately.
>But after I need to combine the RMI and Servlet together in the following
>way, the RMI server can't be connected. Why?
>
>I think it's the URL definition problem. When the JSDK2.1 is started, the
>URL = "rmi://localhost" doesn't work. How can I modify it? The JSDK2.1 uses
>http://localhost:8080. Are there any conflicts between them?
>
>Thanks!
>Bing
>
>import java.rmi.*;
>import java.rmi.server.*;
>import java.sql.Connection;
>import java.io.*;
>
>import javax.servlet.*;
>import javax.servlet.http.*;
>import java.text.*;
>import java.util.*;
>
>public class DBOpServlet extends HttpServlet
>{
> public void doPost(HttpServletRequest request, HttpServletResponse
>response)
> throws ServletException, IOException
> {
> System.setSecurityManager(new RMISecurityManager());
> String url = "rmi://localhost/";
>
> .....
> .....
>
> try
> {
> DBOperations cop8 = (DBOperations)Naming.lookup(url
+
>"FindStudentByCourseID");
> DBOperations cop15 = (DBOperations)Naming.lookup(url
+ "Quit");
>
> rs = cop8.FindStudentByCourseID(id);
> cop15.Quit();
> }
> catch(Exception e)
> {
> System.out.println("Error " + e);
> }
>
> .....
> .....
>
> response.setContentType("text/html"); // content type
> PrintWriter responseOutput = response.getWriter();
> StringBuffer buf = new StringBuffer();
> buf.append( "<html>\n" );
> buf.append( "<title>Thank you!</title>\n" );
> buf.append( "Thank you for registering.\n" );
> buf.append( "<BR>ID:\n<PRE>" );
> buf.append( "<BR>------------<BR>" );
> buf.append( rs );
> buf.append( "</PRE>\n</html>" );
> responseOutput.println( buf.toString() );
> responseOutput.close();
> }
>}
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 8
> Date: Sun, 26 Nov 2000 13:43:15 -0500
> From: "Mishkin, Ernest" <ernest.Mishkin at qwest.com>
>Subject: RE: RMI & Servlet
>
>What exactly doesn't work ? (i.e. give exception trace)
>
>-----Original Message-----
>From: Li Bing
>To: Mishkin, Ernest; 'Java_Help '; 'Java '; 'Java '; 'Advanced-Java '
>Sent: 11/26/00 11:52 AM
>Subject: RE: RMI & Servlet
>
>Dear Ernest,
>
>Actually, I can use rmi://localhost if running the RMI client
>seperately.
>But after I need to combine the RMI and Servlet together in this way,
>the
>RMI server can be connected. Why?
>
>Thanks,
>Bing
>
>-----Original Message-----
>From: Mishkin, Ernest [mailto:ernest.Mishkin at qwest.com]
>Sent: Sunday, November 26, 2000 8:58 AM
>To: 'Li Bing '; 'Java_Help '; 'Java '; 'Java '; 'Advanced-Java '
>Subject: RE: RMI & Servlet
>
>
>RMI URLs look like //hostname:port/BoundName (no "rmi://" in front).
>Also, check JavaSoft's RMI home page
>(http://www.javasoft.com/products/rmi)
>- a lot of beginners' questions are answered there.
>
>-- Ernest
>
>-----Original Message-----
>From: Li Bing
>To: Li Bing; Java_Help; Java; Java; Advanced-Java
>Sent: 11/26/00 4:15 AM
>Subject: RE: RMI & Servlet
>
>Hi, All,
>
>I think it's the URL definition probelm.
>
>When the JSDK2.1 is started, the URL = "rmi://localhost" won't work.
>
>How can I modify it? The JSDK2.1 uses http://localhost:8080. Are there
>any
>conflicts between them?
>
>Thanks!
>Bing
>
>-----Original Message-----
>From: Li Bing [mailto:bing.li at asu.edu]
>Sent: Sunday, November 26, 2000 1:47 AM
>To: Java_Help; Java; Java; Advanced-Java
>Subject: RMI & Servlet
>
>
>Dear All,
>
>I am trying to use RMI and Servlet. I can use a RMI client to run the
>methods on the RMI server. Can I replace the RMI client with a servlet?
>I
>mean the servlet can run the methods on the RMI server. Thus, I can put
>the
>result on the browser. I tried but failed. I just put the RMI client
>into
>the servlet as follows. Are there something wrong?
>
>By the way, I use JSDK2.1 as my servlet developing tool.
>
>Thanks!
>Bing
>
>import java.rmi.*;
>import java.rmi.server.*;
>import java.sql.Connection;
>import java.io.*;
>
>import javax.servlet.*;
>import javax.servlet.http.*;
>import java.text.*;
>import java.util.*;
>
>public class DBOpServlet extends HttpServlet
>{
> public void doPost(HttpServletRequest request,
>HttpServletResponse
>response)
> throws ServletException, IOException
> {
> System.setSecurityManager(new RMISecurityManager());
> String url = "rmi://localhost/";
>
> .....
> .....
>
> try
> {
> DBOperations cop8 =
>(DBOperations)Naming.lookup(url
>+ "FindStudentByCourseID");
> DBOperations cop15 =
>(DBOperations)Naming.lookup(url
>+ "Quit");
>
> rs = cop8.FindStudentByCourseID(id);
> cop15.Quit();
> }
> catch(Exception e)
> {
> System.out.println("Error " + e);
> }
>
> .....
> .....
>
> response.setContentType("text/html"); // content type
> PrintWriter responseOutput = response.getWriter();
> StringBuffer buf = new StringBuffer();
> buf.append( "<html>\n" );
> buf.append( "<title>Thank you!</title>\n" );
> buf.append( "Thank you for registering.\n" );
> buf.append( "<BR>ID:\n<PRE>" );
> buf.append( "<BR>------------<BR>" );
> buf.append( rs );
> buf.append( "</PRE>\n</html>" );
> responseOutput.println( buf.toString() );
> responseOutput.close();
> }
>}
>
>
>Thanks,
>Bing
>
> CSE, ASU __...----------------..._ ____________
> _.--~~~~~~~~~~~~~~~-.\~~~~~~~~\~-._ _____|| `
> ___ _.-~ 480-965-1746 (O) ~\\_ __ `\ ~-. _.-~`\
> \_-~ 480-965-9038 (L) ___\___/ )\_/-~ `\
> .-~~ ~~~------------------~~~~~ _.--._..--~~ \ /~\|
> .~/ // _-~ _ `\. | /\\ |
> / |___ 480-829-8492 (H) ______.~ /_\ | | |/ ||'
>|` \ |_bing.li at asu.edu_/ _-~ /~\\' | _/ |)=||
>| ~-_|________________/_.-~ // || |_..-~ |\ ||
>.. __________ \/ ____________ /()= || __./\\//
> \(_)\_______) (_________/(_) / \\ ||__..--~~~ ~~~~~~
> `-._________________________..--' \___//~
> `------`--' `---------' - Li Bing
> www.public.asu.edu/~libing
>
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 9
> Date: Sun, 26 Nov 2000 11:49:42 -0700
> From: Li Bing <bing.li at asu.edu>
>Subject: RE: RMI & Servlet
>
>The RMI server can't be connected. There is no any response there. And
>"rror
>500" is displayed in the browser.
>
>
>-----Original Message-----
>From: Mishkin, Ernest [mailto:ernest.Mishkin at qwest.com]
>Sent: Sunday, November 26, 2000 11:43 AM
>To: 'Li Bing '; Mishkin, Ernest; ''Java_Help ' '; ''Java ' '; ''Java '
>'; ''Advanced-Java ' '
>Subject: RE: RMI & Servlet
>
>
>What exactly doesn't work ? (i.e. give exception trace)
>
>-----Original Message-----
>From: Li Bing
>To: Mishkin, Ernest; 'Java_Help '; 'Java '; 'Java '; 'Advanced-Java '
>Sent: 11/26/00 11:52 AM
>Subject: RE: RMI & Servlet
>
>Dear Ernest,
>
>Actually, I can use rmi://localhost if running the RMI client
>seperately.
>But after I need to combine the RMI and Servlet together in this way,
>the
>RMI server can be connected. Why?
>
>Thanks,
>Bing
>
>-----Original Message-----
>From: Mishkin, Ernest [mailto:ernest.Mishkin at qwest.com]
>Sent: Sunday, November 26, 2000 8:58 AM
>To: 'Li Bing '; 'Java_Help '; 'Java '; 'Java '; 'Advanced-Java '
>Subject: RE: RMI & Servlet
>
>
>RMI URLs look like //hostname:port/BoundName (no "rmi://" in front).
>Also, check JavaSoft's RMI home page
>(http://www.javasoft.com/products/rmi)
>- a lot of beginners' questions are answered there.
>
>-- Ernest
>
>-----Original Message-----
>From: Li Bing
>To: Li Bing; Java_Help; Java; Java; Advanced-Java
>Sent: 11/26/00 4:15 AM
>Subject: RE: RMI & Servlet
>
>Hi, All,
>
>I think it's the URL definition probelm.
>
>When the JSDK2.1 is started, the URL = "rmi://localhost" won't work.
>
>How can I modify it? The JSDK2.1 uses http://localhost:8080. Are there
>any
>conflicts between them?
>
>Thanks!
>Bing
>
>-----Original Message-----
>From: Li Bing [mailto:bing.li at asu.edu]
>Sent: Sunday, November 26, 2000 1:47 AM
>To: Java_Help; Java; Java; Advanced-Java
>Subject: RMI & Servlet
>
>
>Dear All,
>
>I am trying to use RMI and Servlet. I can use a RMI client to run the
>methods on the RMI server. Can I replace the RMI client with a servlet?
>I
>mean the servlet can run the methods on the RMI server. Thus, I can put
>the
>result on the browser. I tried but failed. I just put the RMI client
>into
>the servlet as follows. Are there something wrong?
>
>By the way, I use JSDK2.1 as my servlet developing tool.
>
>Thanks!
>Bing
>
>import java.rmi.*;
>import java.rmi.server.*;
>import java.sql.Connection;
>import java.io.*;
>
>import javax.servlet.*;
>import javax.servlet.http.*;
>import java.text.*;
>import java.util.*;
>
>public class DBOpServlet extends HttpServlet
>{
> public void doPost(HttpServletRequest request,
>HttpServletResponse
>response)
> throws ServletException, IOException
> {
> System.setSecurityManager(new RMISecurityManager());
> String url = "rmi://localhost/";
>
> .....
> .....
>
> try
> {
> DBOperations cop8 =
>(DBOperations)Naming.lookup(url
>+ "FindStudentByCourseID");
> DBOperations cop15 =
>(DBOperations)Naming.lookup(url
>+ "Quit");
>
> rs = cop8.FindStudentByCourseID(id);
> cop15.Quit();
> }
> catch(Exception e)
> {
> System.out.println("Error " + e);
> }
>
> .....
> .....
>
> response.setContentType("text/html"); // content type
> PrintWriter responseOutput = response.getWriter();
> StringBuffer buf = new StringBuffer();
> buf.append( "<html>\n" );
> buf.append( "<title>Thank you!</title>\n" );
> buf.append( "Thank you for registering.\n" );
> buf.append( "<BR>ID:\n<PRE>" );
> buf.append( "<BR>------------<BR>" );
> buf.append( rs );
> buf.append( "</PRE>\n</html>" );
> responseOutput.println( buf.toString() );
> responseOutput.close();
> }
>}
>
>
>Thanks,
>Bing
>
> CSE, ASU __...----------------..._ ____________
> _.--~~~~~~~~~~~~~~~-.\~~~~~~~~\~-._ _____|| `
> ___ _.-~ 480-965-1746 (O) ~\\_ __ `\ ~-. _.-~`\
> \_-~ 480-965-9038 (L) ___\___/ )\_/-~ `\
> .-~~ ~~~------------------~~~~~ _.--._..--~~ \ /~\|
> .~/ // _-~ _ `\. | /\\ |
> / |___ 480-829-8492 (H) ______.~ /_\ | | |/ ||'
>|` \ |_bing.li at asu.edu_/ _-~ /~\\' | _/ |)=||
>| ~-_|________________/_.-~ // || |_..-~ |\ ||
>.. __________ \/ ____________ /()= || __./\\//
> \(_)\_______) (_________/(_) / \\ ||__..--~~~ ~~~~~~
> `-._________________________..--' \___//~
> `------`--' `---------' - Li Bing
> www.public.asu.edu/~libing
>
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 10
> Date: Sun, 26 Nov 2000 14:02:22 -0600
> From: Xiaoying Bai <xiaoying.bai at asu.edu>
>Subject: Rollback Exception
>
>Hi there,
>
>I'm using EJB in our project. The overall structure is: clients (an java
>application) connect to session bean, session beans connect to entity
>beans, and entity beans are connected to CloudScape Database. Now I got the
>following exception:
>
>java.rmi.ServerException: RmoteException occurred in server threadl nested
>exception is:
>java.rmi.ServerException: RemoteException occurred in server thread; nested
>exception is:
>java.rmi.RemoteException: Transaction aborted (possibly due to transaction
>time out); nested exception is:
>javax.transaction.RollbackException.
>
>Does anyone who has similar experience? How to deal with it? Thanks a lot!
>
>Bai
>
>
>[This message contained attachments]
>
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 11
> Date: 26 Nov 2000 23:44:52 -0500
> From: John Lusk <jlusk4 at yahoo.com>
>Subject: Re: The threads slow down :(
>
>"SY" == Shilong Yao <tomadvancedjava at china.com> writes:
>
> [stuff deleted]
>
> SY> Is there any method can help prevent the thread from slowing
> SY> down when the number of the running threads increase?
>
>Sure! Buy more hardware!
>
>(Although this is highly imprecise, you can think of a thread as a
>process. The more processes you start on a system, the slower each
>runs. Same w/threads.)
>
>John.
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 12
> Date: Mon, 27 Nov 2000 09:55:33 +0500
> From: <debapriya.ghosh at processbiz.co.in>
>Subject: Re: EJB Object implementation
>
>Hi,
> EJBObject and EJBHome are network visible objects(whereas bean class
>is not.). Hence their base classes extend "javax.rmi.remote" whose
>implementation is provided by the container.
>Now referring to your question your bean remote interface extends the
>EJBObject interface and the EJBObject class implements(implemented by
>the container) your bean remote interace :-))
>The reasons are manyfold:
>**By intercepting requests, the EJB container can automatically perform
>some necessary management that includes transaction logic,security
>logic, bean instance pooling logic and many other logic that the
>container may require.
>
>**In short when u call create() on home interface the container creates
>a EJBObject and associates it with a class instance from the pool.(the
>primary key is the binding factor between the two.)
>
>Hope this helps.
>
>Ghosh
>
>----- Original Message -----
>From: "Ashutosh" <sashutosh at opussoft.com>
>Date: Friday, November 24, 2000 11:33 am
>Subject: EJB Object implementation
>
> > Hello all,
> > I am trying to understand the concept of the EJB
> > Object . I
> > have the following question.
> > I read that the EJBObject whose implementation is
> > provided by
> > the container also implements the Remote Interface.The EJB Object
> > holds a
> > reference to the Bean class. However, the Bean class provides the
> > implementation for the business methods that are declared in the
> > remoteinterface(but it does not "implement" the RI but only
> > extends EntityBean).
> > So, can i infer that EJBObject has an empty definition
> > of the
> > business methods and through these methods gives a call to the
> > correspondingmethods of the bean class whenever the client invokes
> > the method.
> > I understand that the container provides the
> > implementationof the ejb object and it could be different across
> > various containers. But
> > how does it work i this case???
> > Thanks.
> > Regards,
> > Ashutosh
> >
> >
> > ---
> > To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
> > To get help, mail advanced-java-help at xcf.berkeley.edu
> >
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 13
> Date: Mon, 27 Nov 2000 13:06:26 +0530
> From: "Akhil Nagpal" <ankul at neuralmagic.com>
>Subject: java - SOAP
>
>hi
>
>any resources, tutorials or examples of building applns SOAP framework in
>java
>
>thnks
>
>akhil
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 14
> Date: Mon, 27 Nov 2000 08:44:15 +0100
> From: Kaj Bjurman <kaj.bjurman at aktiesparinvest.se>
>Subject: RE: Can I regard a "thread" as a "control flow"?
>
>Hi,
>
>I saw that you already have received some answers to this question, but I
>would like to add this...
>
> > So it seemed the non-thread object t has 2 copies of running
> > instance:
>
>There is only one instance of t, but two threads are calling method p on
>that instance.
>
> > An other question is that I think a program exits only when
> > all of its threads exit.
>
>That is only partly true.
>"The Java Virtual Machine exits when the only threads running are all
>daemon
>threads." (From the javadoc for Thread).
>See user/daemon threads.
>
>I would also like to say that the behaviour of your program is platform
>dependent.
>It looks like your platform uses some kind of round robin scheduling for
>threads of the same priority, but there is nothing in the Java language
>which says how threads should be scheduled.
>
>/Kaj
>
>~~~~~~~~~ ~~~~ ~~~ ~~ ~ ~ ~ ~
>kaj.bjurman at hiq.se
>+46 70 4200148
>
>
> > -----Original Message-----
> > From: Shilong Yao [mailto:tomadvancedjava at china.com]
> > Sent: Saturday, November 25, 2000 2:48 AM
> > To: advanced-java at xcf.berkeley.edu
> > Subject: Can I regard a "thread" as a "control flow"?
> >
> >
> > Dear friends,
> > I am a college student. I have a question to ask you. Thanks!
> > I think a thread is not a certain object but a control flow.
> > Is it right?
> > See the example:
> > class T {
> > public void p(String k) {
> > while (true)
> > System.out.print(k);
> > }
> > }
> > public class Untitled1 {
> > T t = new T();
> > ///////////////////////////////////
> > public class TT extends Thread {
> > String k;
> > public TT(String i) {
> > k=i;
> > start();
> > }
> > public void run() {
> > t.p(k);
> > }
> > }
> > ///////////////////////////////////
> > public void gogo() {
> > TT t1=new TT("aaaaa"),
> > t2=new TT("-----");
> > }
> > public static void main(String[] args) {
> > Untitled1 untitled11 = new Untitled1();
> > untitled11.gogo();
> > System.out.println("End!!!!!!!!!");
> > }
> > }
> > t is a non-thread object. But 2 threads call t's method p().
> > The result turned out
> > to be:
> > End!!!!!!!!!
> > aaaaaaaaaaaaaaaaaaaa----aaaa----aaaa----aaaa---- . . .
> > (infinitive loop)
> > So it seemed the non-thread object t has 2 copies of running
> > instance: one printing
> > "aaaa" and other is printing "----". So I think to regard a
> > thread as a control flow
> > is more suitable.
> > For a thread the control flow is in run().
> > For a certain UI, say a Dialog or a Window, the control flow
> > is in its message dispatcher's
> > loop. Is it right?
> >
> > An other question is that I think a program exits only when
> > all of its threads exit. So
> > in the program above, untitledl1.gogo() exited but the thread
> > t1 and t2 never exit, so
> > the whole program will never exit. Is it right?
> >
> > Thanks again! I am looking forward to your answer!!!
> >
> > Shilong Yao
> > tomadvancedjava at china.com
> >
> >
> > ---
> > To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
> > To get help, mail advanced-java-help at xcf.berkeley.edu
> >
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 15
> Date: Mon, 27 Nov 2000 08:50:55 +0100
> From: Kaj Bjurman <kaj.bjurman at aktiesparinvest.se>
>Subject: RE: The threads slow down :(
>
>Hi,
>
>Regarding:
> > The conclusion is that the time resource of a
> > java application is a fixed value.
>
>That conclusion is platform/JVM dependent. It might be implemented in other
>ways on other platforms, and on other JVMs.
>
>/Kaj
>
>~~~~~~~~~ ~~~~ ~~~ ~~ ~ ~ ~ ~
>kaj.bjurman at hiq.se
>+46 70 4200148
>
> > -----Original Message-----
> > From: Shilong Yao [mailto:tomadvancedjava at china.com]
> > Sent: Sunday, November 26, 2000 3:40 PM
> > To: post
> > Subject: The threads slow down :(
> >
> >
> > Dear All,
> > See the following example:
> > //////////////////////////////////////////////////////////////
> > ///////////
> > class Counter extends Thread {
> > int id;
> > long ii=0;
> > public Counter(int idd) {
> > id =idd; ii=0;
> > start();
> > }
> > public void run() {
> > System.out.print(id);
> > System.out.println(" thread running");
> > while (true) {
> > this.yield();
> > ii++;
> > }
> > }
> > public void p() {System.out.print(" *");System.out.print(ii);};
> > }
> > public class Count extends Thread {
> > int nr = 5;
> > Counter c[] = new Counter[nr];
> > public Count() {}
> > public void run() {
> > for (int i=0; i<nr; i++)
> > c[i]=new Counter(i);
> > long begin = System.currentTimeMillis();
> > long curr, span;
> > while (true) {
> > curr = System.currentTimeMillis();
> > span = curr -begin;
> > if (span >= 20000) break;
> > this.yield();
> > }
> > System.out.print("Time Span=");
> > System.out.println(span);
> > System.out.print("ActiveThreadCount=");
> > System.out.println(Thread.activeCount());
> > for (int i=0; i<nr; i++) {c[i].p();c[i].stop();}
> > System.out.println();
> > }
> > public static void main(String args[]) {
> > Count cc = new Count();
> > cc.start();
> > }
> > }
> > //////////////////////////////////////////////////////////////
> > ///////////
> > The result is :
> > 0 thread running
> > 1 thread running
> > 2 thread running
> > 4 thread running
> > TimeSpan=20000
> > ActiveThreadCount=7
> > *743938 *743938 *743938 *0 *743938
> >
> > ======================================
> > I altered "nr" and let it be from 1 to 18. Thus the total
> > number of active threads
> > is from 3 to 20. From the number that had been counted by the
> > Counter objects we
> > can determine how many time units did every Counter thread
> > got in 20 seconds.
> > From the result, we can see all the Counter thread counted
> > the same number. That
> > is to say the time slice was shared alike amoung the threads.
> > Then I draw a chart
> > whose x-axis represents the number of the total active
> > threads and y-axis represents
> > the time units each thread got. It turned out to be like the
> > function y=exp(-x).
> > The time units each thread got run down sharply as the number
> > of total threads
> > goes up.
> > The conclusion is that the time resource of a java
> > application is a fixed value.
> > If the number of the running thread in the application
> > increase, every thread runs
> > more and more slowly. Is there any method can help prevent
> > the thread from slowing
> > down when the number of the running threads increase?
> > Shilong Yao
> > tomadvancedjava at china.com
> >
> >
> > ---
> > To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
> > To get help, mail advanced-java-help at xcf.berkeley.edu
> >
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 16
> Date: Mon, 27 Nov 2000 09:27:25 -0000
> From: "Wathen, Dave" <dave.wathen at gs.com>
>Subject: RE: J2EE Pattern
>
>There's the J2EE Blueprints available in print or download from
>http://java.
>sun.com/j2ee/download.html#blueprints
>
>Regards
>
>Dave Wathen
>Goldman Sachs Asset Management
>3rd Floor, Procession House
>55 Ludgate Hill
>London EC4M 7JN
>+44 (0)20-7774-2998
>
>It is not necessary to understand things in order to argue about them.
>(Caron de Beaumarchais)
>
>
>-----Original Message-----
>From: splash [mailto:egroupjava at 263.net]
>Sent: Sunday, November 26, 2000 8:35 AM
>To: Advanced-Java at Xcf.Berkeley.Edu
>Subject: J2EE Pattern
>
>
>Hi All:
>Now I am trying to conclude some patterns can be used in developing a j2ee
>project,
>for i will begin a project's design.
>who can give me some resource?mail to this addrsss please. liulie at 263.net
>tnx.
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 17
> Date: Mon, 27 Nov 2000 15:28:22 +0530
> From: Rajesh Jumde <rj at aitpl.stpn.soft.net>
>Subject: how to close a server socket, if there is no request from client
>for a period of time
>
>Hi,
> I am working on sockets.
>I am facing a problem.
>I had a server which listens on a socket and w.r.t the client request it
>reacts,
>but always waits for the particular period of time, for the client to
>make request.
>If there is no request for a particular period of time the server reacts
>accordingly.
>so how can i achieve this through sockets.
>Means server should wait for some time and if there is no request for
>it,
>it reacts accordingly.
>Any help is apperciated.....
>Thanx in advance..
>
>Rajesh
>
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 18
> Date: Mon, 27 Nov 2000 10:02:43 +0000 (GMT)
> From: Nicholas Wright <nick at ist.co.uk>
>Subject: Re: how to close a server socket, if there is no request from
>client for a period of time
>
>Hi
>
>Well, in the most basic terms:
>
> 1. When your Socket is ready to receive data, start a timing
thread,
> and possibly pass it the Socket as a parameter.
>
> 2. If you happen to receive some data, kill the thread.
>
> 3. If the thread happens to reach its time limit, get it to close
the
> socket - or whatever you want it to do.
>
>Isn't it that simple?
>
>Nicholas
>
>
> > Hi,
> > I am working on sockets.
> > I am facing a problem.
> > I had a server which listens on a socket and w.r.t the client request it
> > reacts,
> > but always waits for the particular period of time, for the client to
> > make request.
> > If there is no request for a particular period of time the server reacts
> > accordingly.
> > so how can i achieve this through sockets.
> > Means server should wait for some time and if there is no request for
> > it,
> > it reacts accordingly.
> > Any help is apperciated.....
> > Thanx in advance..
> >
> > Rajesh
> >
> >
> >
> > ---
> > To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
> > To get help, mail advanced-java-help at xcf.berkeley.edu
>
>===========================================================================
>Nicholas Wright Imperial Software Technology Senior Software Engineer
>---------------------------------------------------------------------------
>Email : nick at ist.co.uk or support at ist.co.uk
>Berkshire House 120 Hawthorne Ave, #101
>252 Kings Road Palo Alto
>Reading RG1 4HP United Kingdom California 94301 USA
>Tel: +44 118 958 7055 Tel: 650 688 0200
>FAX: +44 118 958 9005 FAX: 650 688 1054
>===========================================================================
>****** VISAJ AT http://www.ist.co.uk/visaj ******
>===========================================================================
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 19
> Date: Mon, 27 Nov 2000 10:08:01 +0000
> From: YErkan at ddsi.ie
>Subject: Re: J2EE Pattern
>
>
>Hi,
>
>Have a look at The ServerSide.Com. There is a J2EE patterns repository:
>
>http://theserverside.com/patterns/index.jsp
>
>Regards,
>
>
> Yagiz Erkan
>
>
>
>
>Hi All:
>Now I am trying to conclude some patterns can be used in developing a j2ee
>project,
>for i will begin a project's design.
>who can give me some resource?mail to this addrsss please. liulie at 263.net
>tnx.
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 20
> Date: Mon, 27 Nov 2000 12:16:33 +0200
> From: Mariana <mariana at cstdev.cst.ro>
>Subject: Re: Sending PDF from servlet
>
>Hi, Murali!
>
>I need to implement the download code because I have to keep track of the
>users who want to see the document. For this reason, I must save some
>information in the database before I send the pdf.
>
>Mariana
>
>"Kaguturu, Murali (USPC)" wrote:
>
> > Hi Mariana,
> > Why do you need to implement the download code. Why not point the link
> > directly to the file (ofcourse the file needs to be in the Webserver
> > directory).
> >
> > http://your.domain.com/your-directory/file.pdf
> >
> > Now webserver would take care of this.
> >
> > murali
> >
> > -----Original Message-----
> > From: Mariana [mailto:mariana at cstdev.cst.ro]
> > Sent: Friday, November 24, 2000 4:35 AM
> > To: advanced-java at xcf.berkeley.edu
> > Subject: Sending PDF from servlet
> >
> > Hi
> > I have to send a PDF from a servlet to the client. This code works fine
> > on Netscape; however it asks me two times if I want to open/save the
> > file on IE. Has anybody an idea of this problem or a better solution for
> > it?
> >
> > Here is the code:
> >
> > ServletOutputStream out = res.getOutputStream ();
> > String fileURL = "a_file.pdf";
> > BufferedInputStream bis = null;
> > BufferedOutputStream bos = null;
> >
> > try {
> > URL url = new URL( "http", "localhost", fileURL );
> >
> > response.setContentType( "application/pdf" ); // MIME type for
> > pdf doc
> > response.setHeader("Content-Disposition",
> > "attachment;filename=Example.pdf" );
> >
> > bis = new BufferedInputStream(url.openStream());
> > bos = new BufferedOutputStream(out);
> > byte[] buff = new byte[2048];
> > int bytesRead;
> >
> > while(-1 != (bytesRead = bis.read(buff, 0, buff.length)))
> > {
> > bos.write(buff, 0, bytesRead);
> > }
> > catch( ....
> >
> > Thanks,
> > Mariana
> >
> > ---
> > To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
> > To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>[This message contained attachments]
>
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 21
> Date: Mon, 27 Nov 2000 15:54:47 +0530
> From: "Gokul Singh" <gokul.singh at wipro.com>
>Subject: Re: how to close a server socket, if there is no request from
>client for a period of time
>
>Hi,
>
>You can have a look at the following methods
>
>for a socket ==> java.net.Socket.setSOTimeout()
>for a ServerSocket ==> java.net.ServerSocket.setSOTimeout()
>
>I hope this will solve your problem.
>
>Regds,
>Gokul
>
>----- Original Message -----
>From: "Nicholas Wright" <nick at ist.co.uk>
>To: <advanced-java at xcf.berkeley.edu>; <rj at aitpl.stpn.soft.net>
>Sent: Monday, November 27, 2000 3:32 PM
>Subject: Re: how to close a server socket, if there is no request from
>client for a period of time
>
>
> > Hi
> >
> > Well, in the most basic terms:
> >
> > 1. When your Socket is ready to receive data, start a timing thread,
> > and possibly pass it the Socket as a parameter.
> >
> > 2. If you happen to receive some data, kill the thread.
> >
> > 3. If the thread happens to reach its time limit, get it to close the
> > socket - or whatever you want it to do.
> >
> > Isn't it that simple?
> >
> > Nicholas
> >
> >
> > > Hi,
> > > I am working on sockets.
> > > I am facing a problem.
> > > I had a server which listens on a socket and w.r.t the client request
>it
> > > reacts,
> > > but always waits for the particular period of time, for the client to
> > > make request.
> > > If there is no request for a particular period of time the server
>reacts
> > > accordingly.
> > > so how can i achieve this through sockets.
> > > Means server should wait for some time and if there is no request for
> > > it,
> > > it reacts accordingly.
> > > Any help is apperciated.....
> > > Thanx in advance..
> > >
> > > Rajesh
> > >
> > >
> > >
> > > ---
> > > To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
> > > To get help, mail advanced-java-help at xcf.berkeley.edu
> >
> >
>===========================================================================
> > Nicholas Wright Imperial Software Technology Senior Software
>Engineer
> >
>--------------------------------------------------------------------------
>-
> > Email : nick at ist.co.uk or support at ist.co.uk
> > Berkshire House 120 Hawthorne Ave, #101
> > 252 Kings Road Palo Alto
> > Reading RG1 4HP United Kingdom California 94301 USA
> > Tel: +44 118 958 7055 Tel: 650 688 0200
> > FAX: +44 118 958 9005 FAX: 650 688 1054
> >
>===========================================================================
> > ****** VISAJ AT http://www.ist.co.uk/visaj
>******
> >
>===========================================================================
> >
> >
> > ---
> > To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
> > To get help, mail advanced-java-help at xcf.berkeley.edu
> >
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 22
> Date: Mon, 27 Nov 2000 02:40:02 -0800
> From: "Chang Chao" <2chao at home.com>
>Subject: [Q] JTable not showing properly
>
>Hi, I'm using Linux Red Hat 6.2, JDK 1.1.8 with Swing 1.1.1 for my
>development. I ran into some problems with JTables. I have the JTables
>inside JScrollPane but when the JTable first appears, it's data is cut off
>vertically, ie some columns are not appearing. But when I resize any one of
>the columns explicitly using the mouse, the data appears properly. I tried
>changing the column width using code but it didn't help. Can anyone tell me
>how to solve this? Thanks very much.
>
>Chang
>
>
>[This message contained attachments]
>
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 23
> Date: Mon, 27 Nov 2000 16:11:29 +0530
> From: SAI VENKATESH <sai at nestec.net>
>Subject: Is pointer assignment Atomic?
>
>
>Dear all,
>
>If I have the following code do I have to synchronize newObjArr which is
>accessed in another thread? Is the assignment Atomic?
>
>Object[] newObjArr = new Object[5];
>:
>:
>Object[] objArr = new Object[10];
>newObjArr = objArr; // Do I have to synchronize this statement
>
>Regards
>Sai
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 24
> Date: Mon, 27 Nov 2000 13:15:38 +0200
> From: "Aisling" <aisling at creator.co.za>
>Subject: Re: [Q] JTable not showing properly
>
>Hi
>If I understand your question correctly, try using the JTable public void
>setAutoResizeMode(int mode) method and set the mode to be AUTO_RESIZE_OFF.
>Solved my problem with JTables not showing all the columns.
>Aisling
>
> -----Original Message-----
> From: Chang Chao <2chao at home.com>
> To: advanced-java at xcf.berkeley.edu <advanced-java at xcf.berkeley.edu>
> Date: Monday, November 27, 2000 1:05 PM
> Subject: [Q] JTable not showing properly
>
>
> Hi, I'm using Linux Red Hat 6.2, JDK 1.1.8 with Swing 1.1.1 for my
>development. I ran into some problems with JTables. I have the JTables
>inside JScrollPane but when the JTable first appears, it's data is cut off
>vertically, ie some columns are not appearing. But when I resize any one of
>the columns explicitly using the mouse, the data appears properly. I tried
>changing the column width using code but it didn't help. Can anyone tell me
>how to solve this? Thanks very much.
>
> Chang
>
>
>[This message contained attachments]
>
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>Message: 25
> Date: Mon, 27 Nov 2000 17:02:55 +0530
> From: Khem Chand Sachdeva <ksuchdeva at npi.stpn.soft.net>
>Subject: diff between green and native threads
>
>Hi
>Could anybody tell me the difference between Green Threads and Native
>Threads in Java ??
>Thanx in advance
>Khem,
>
>
>
>---
>To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
>To get help, mail advanced-java-help at xcf.berkeley.edu
>
>
>________________________________________________________________________
>________________________________________________________________________
>
>
>
____________________________________________________________________________
_________
Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com
---
To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
To get help, mail advanced-java-help at xcf.berkeley.edu
---
To unsubscribe, mail advanced-java-unsubscribe at xcf.berkeley.edu
To get help, mail advanced-java-help at xcf.berkeley.edu
More information about the Advanced-java
mailing list