jukebox4-cvs Mailing List for Jukebox (Page 2)
Brought to you by:
vtt
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
(48) |
Apr
(33) |
May
(23) |
Jun
(55) |
Jul
(79) |
Aug
(48) |
Sep
(12) |
Oct
(23) |
Nov
(23) |
Dec
(4) |
---|
From: CVS B. <vt...@fr...> - 2000-11-02 08:38:04
|
User: vt Date: 00/11/01 23:55:43 Modified: . configure.in Log: Added the test case for checking the proper handling of the multiple value configuration elements. Revision Changes Path 1.68 +2 -1 J4/configure.in CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/configure.in?annotate=1.68&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/configure.in?rev=1.68&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/configure.in.diff?r1=1.68&r2=1.67&cvsroot=jukebox4 ----------------------------------- Index: configure.in =================================================================== RCS file: /usr/local/cvs/J4/configure.in,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- configure.in 2000/10/25 06:56:46 1.67 +++ configure.in 2000/11/02 06:55:43 1.68 @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_REVISION($Id: configure.in,v 1.67 2000/10/25 06:56:46 vt Exp $)dnl +AC_REVISION($Id: configure.in,v 1.68 2000/11/02 06:55:43 vt Exp $)dnl dnl I'd like it to read the ./configure-options to allow both the basic set dnl of options, as well as the local set. @@ -478,6 +478,7 @@ src/scripts/run/ejbserver src/scripts/test/Makefile src/scripts/test/LruCache + src/scripts/test/MultipleConfigurationElements src/scripts/test/SemaphoreGroup Makefile ) |
From: CVS B. <vt...@fr...> - 2000-11-02 08:38:03
|
User: vt Date: 00/11/01 23:57:51 Modified: src/scripts/test .cvsignore Log: Checkpoint on the way to implement a shutdown(Throwable failureCause) call, as opposed to no-argument shutdown(). Point is, I want to know why the execute() died, if it did. Revision Changes Path 1.2 +1 -0 J4/src/scripts/test/.cvsignore CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/test/.cvsignore?annotate=1.2&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/test/.cvsignore?rev=1.2&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/test/.cvsignore.diff?r1=1.2&r2=1.1&cvsroot=jukebox4 ----------------------------------- Index: .cvsignore =================================================================== RCS file: /usr/local/cvs/J4/src/scripts/test/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- .cvsignore 2000/10/25 06:56:50 1.1 +++ .cvsignore 2000/11/02 06:57:51 1.2 @@ -1,6 +1,7 @@ Makefile Makefile.in LruCache +MultipleConfigurationElements SemaphoreGroup RWLock .deps |
From: CVS B. <vt...@fr...> - 2000-10-25 06:56:54
|
User: vt Date: 00/10/24 23:56:50 Added: src/scripts/run .cvsignore Makefile.am ejbserver.in j4wrapper.in Log: Moved the files from gnu.j4.examples to gnu.j4.test.unit and gnu.j4.test.integration, where they belong. Also, makeup changes and small fixes. Revision Changes Path 1.1 J4/src/scripts/run/.cvsignore CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/run/.cvsignore?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/run/.cvsignore?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: .cvsignore =================================================================== Makefile Makefile.in j4wrapper ejbserver 1.1 J4/src/scripts/run/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/run/Makefile.am?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/run/Makefile.am?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== # $Id: Makefile.am,v 1.1 2000/10/25 06:56:50 vt Exp $ bin_PROGRAMS = j4wrapper ejbserver j4wrapper_SOURCES = j4wrapper if EJB ejbserver_SOURCES = ejbserver else ejbserver_SOURCES = endif RM = @RM@ clean-generic: ${RM} -f *~ .*~ j4wrapper: if EJB ejbserver: endif 1.1 J4/src/scripts/run/ejbserver.in CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/run/ejbserver.in?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/run/ejbserver.in?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: ejbserver.in =================================================================== #! /bin/sh # $Id: ejbserver.in,v 1.1 2000/10/25 06:56:50 vt Exp $ # This script runs the gnu.j4.ejb.EjbServer class. prefix=@prefix@ JAVA_OPT="@JAVA_OPT@ -Djava.security.policy=${prefix}/etc/ejbserver.policy" TARGET_CLASSPATH=@prefix@/lib/@PACKAGE@.jar:\ @EJB11_CLASSES@:\ @EJB10_CLASSES@:\ @JNDI_CLASSES@:\ @JTA_CLASSES@:\ @JTS_CLASSES@:\ @REX_CLASSES@:\ @prefix@/lib/generated/classes:\ @prefix@/examples/hello.jar:\ ${CLASSPATH} cd @prefix@ && @JAVAX@ gnu.j4.service.ApplicationWrapper gnu.j4.ejb.EjbServer $* 1.1 J4/src/scripts/run/j4wrapper.in CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/run/j4wrapper.in?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/run/j4wrapper.in?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: j4wrapper.in =================================================================== #! /bin/sh # # $Id: j4wrapper.in,v 1.1 2000/10/25 06:56:50 vt Exp $ # # This script is used to run the classes extending the # gnu.j4.service.RunnableService. Please see the documentation - the wrapper # class itself has some opions. # # J4WRAPPER environment variable TARGET_CLASSPATH=@prefix@/lib/@PACKAGE@.jar:\ @JMX_CLASSES@:\ @JMXTOOLS_CLASSES@:\ @XERCES_CLASSES@:\ ${CLASSPATH} JAVA_OPT="@JAVA_OPT@" @JAVAX@ ${J4WRAPPER} gnu.j4.service.ApplicationWrapper $* |
User: vt Date: 00/10/24 23:56:49 Added: src/java/gnu/j4/test/unit .cvsignore Http11ChunkedOutputStream.java LruCache.java Makefile.am RWLock.java SemaphoreGroup.java ServerSocket.java ThreadTest.java VectorVsStringSearch.java package.html Log: Moved the files from gnu.j4.examples to gnu.j4.test.unit and gnu.j4.test.integration, where they belong. Also, makeup changes and small fixes. Revision Changes Path 1.1 J4/src/java/gnu/j4/test/unit/.cvsignore CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/.cvsignore?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/.cvsignore?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: .cvsignore =================================================================== Makefile Makefile.in *.class .deps 1.1 J4/src/java/gnu/j4/test/unit/Http11ChunkedOutputStream.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/Http11ChunkedOutputStream.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/Http11ChunkedOutputStream.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: Http11ChunkedOutputStream.java =================================================================== package gnu.j4.test.unit; import java.io.PrintWriter; /** * This is a test case for {@link gnu.j4.net.Http11ChunkedOutputStream * Http11ChunkedOutputStream} class. * * @version $Id: Http11ChunkedOutputStream.java,v 1.1 2000/10/25 06:56:48 vt Exp $ */ public class Http11ChunkedOutputStream { public static void main(String args[]) { System.out.println("-------------8<-----------"); gnu.j4.net.Http11ChunkedOutputStream cout = new gnu.j4.net.Http11ChunkedOutputStream(System.out); PrintWriter pw = new PrintWriter(cout); pw.println("Before this line you must see the chunk header."); pw.print("This is just some random text to see how good the chunk works. "); pw.print("This is just a sentence to add some more words to the output. "); pw.println("This is a last sentence in the second paragraph."); pw.flush(); pw.flush(); // to make sure the double flush doesn't close the stream pw.println("One more paragraph with the chunk header above it."); pw.println("This should be the last sentence, with CRLF 0 CRLF below it."); pw.close(); System.out.println("-------------8<-----------"); } } 1.1 J4/src/java/gnu/j4/test/unit/LruCache.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/LruCache.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/LruCache.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: LruCache.java =================================================================== package gnu.j4.test.unit; import java.util.Random; import gnu.j4.core.Logger; import gnu.j4.service.ActiveService; import gnu.j4.cache.*; /** * Test for {@link gnu.j4.cache.LruCache LRU Cache}. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1999 * @version $Id: LruCache.java,v 1.1 2000/10/25 06:56:48 vt Exp $ */ public class LruCache extends ActiveService { protected static final int BUFSIZE = 50; protected static final int CACHESIZE = 10; protected Cacheable target[]; protected Object key[]; protected gnu.j4.cache.LruCache cache = new gnu.j4.cache.LruCache(CACHESIZE); protected Random R = new Random(); protected int hits = 0; protected int misses = 0; /** * Log facility to use for this class. */ public static final String CH_CT = "LRU"; /** * Create a bunch of objects and populate the test array, along with the * key array. * * @return true * @exception InterruptedException if this thread was interrupted by * another thread. */ protected void startup() throws InterruptedException { target = new Cacheable[BUFSIZE]; key = new Object[BUFSIZE]; for ( int idx = 0; idx < BUFSIZE; idx++ ) { Cacheable c = new CString("Entry #", idx); target[idx] = c; key[idx] = c.getCacheKey(); } } /** * Hit the cache randomly. * * @return true * @exception InterruptedException if this thread was interrupted by * another thread. */ protected void execute() throws InterruptedException { for ( int idx = 0; idx < BUFSIZE * 10; idx++ ) { put(random()); get(random()); } } protected void put(int idx) { complain(LOG_INFO, CH_CT, "put " + target[idx]); cache.put(target[idx]); } protected void get(int idx) { complain(LOG_INFO, CH_CT, "get " + target[idx]); if ( cache.get(key[idx]) == null ) { misses++; } else { hits++; } } protected int random() { int r = R.nextInt(); if ( r < 0 ) { r = -r; } return (r % BUFSIZE); } /** * Report the results. * * @return true * @exception InterruptedException if this thread was interrupted by * another thread. */ protected void shutdown() throws InterruptedException { int total = hits + misses; double pHits = (((double)hits)/((double)total))*100; double pMisses = (((double)misses)/((double)total))*100; complain(LOG_NOTICE, CH_CT, "Hits: " + hits + "(" + pHits + "%)"); complain(LOG_NOTICE, CH_CT, "Misses: " + misses + "(" + pMisses + "%)"); } protected class CString implements Cacheable { protected String s; protected Integer key; CString(String s, int idx) { this.s = s + ":" + idx; key = new Integer(idx); } public Object getCacheKey() { return key; } public String toString() { return s; } } } 1.1 J4/src/java/gnu/j4/test/unit/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/Makefile.am?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/Makefile.am?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== # $Id: Makefile.am,v 1.1 2000/10/25 06:56:48 vt Exp $ EXTRA_DIST = package.html noinst_PROGRAMS = package package_SOURCES = Http11ChunkedOutputStream.java \ LruCache.java \ RWLock.java \ SemaphoreGroup.java \ ServerSocket.java \ ThreadTest.java \ VectorVsStringSearch.java ECHO = @ECHO@ JAVACX = @JAVACX@ RM = @RM@ SUFFIXES = .java .class .java.class: - @ ${ECHO} "Making $<" @ ${JAVACX} $< package: $(package_OBJECTS) $(package_DEPENDENCIES) clean-compile: ${RM} -f *.class clean-generic: ${RM} -f *~ .*~ 1.1 J4/src/java/gnu/j4/test/unit/RWLock.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/RWLock.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/RWLock.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: RWLock.java =================================================================== package gnu.j4.test.unit; import java.util.Random; import gnu.j4.core.ANSI; import gnu.j4.service.ActiveService; /** * {@link gnu.j4.sem.RWLock Multiple readers, single writer} test case. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 2000 * @version $Id: RWLock.java,v 1.1 2000/10/25 06:56:48 vt Exp $ */ public class RWLock extends ActiveService { protected gnu.j4.sem.RWLock lock = new gnu.j4.sem.RWLock(); protected Random R = new Random(); /** * Create the test instance. */ public RWLock() { } /** * @exception InterruptedException if this thread was interrupted by * another thread. */ protected void startup() throws InterruptedException, Throwable { for ( int r = 0; r < 10; r++ ) { Consumer c = new Reader(r); c.start(); addDependant(c); } for ( int w = 0; w < 2; w++ ) { Consumer c = new Writer(w); c.start(); addDependant(c); } } protected void execute() throws InterruptedException { Thread.sleep(180000); } protected void shutdown() throws InterruptedException { complain(LOG_INFO, "RWLock", "Shut down."); } /** */ abstract class Consumer extends ActiveService { int id; Object theLock; Consumer(int id) { this.id = id; } /** * Do nothing. * * @return true. */ protected void startup() throws InterruptedException { } /** * Request the lock once in a while, hold it for a while, release it * and do it again until stopped. * * The kind of lock (read or write) is defined by {@link #getLock * getLock} implementation. */ protected void execute() throws Throwable { while ( isEnabled() ) { Thread.sleep(R.nextInt(3000)); complain(LOG_NOTICE, getChannel(), "[" + id + "] " + getColor() + "Waiting for the lock"); getLock(); complain(LOG_NOTICE, getChannel(), "[" + id + "] " + getColor() + "Got the lock"); Thread.sleep(R.nextInt(3000)); lock.release(theLock); complain(LOG_NOTICE, getChannel(), "[" + id + "] " + getColor() + "Released the lock"); } } /** * Complain. * * @return true. */ protected void shutdown() throws InterruptedException { complain(LOG_INFO, "Consumer", "[" + id + "] Shut down."); } abstract void getLock() throws InterruptedException; abstract String getChannel(); abstract String getColor(); } protected class Reader extends Consumer { Reader(int id) { super(id); } void getLock() throws InterruptedException { theLock = lock.getReadLock(); } String getChannel() { return "READER"; } String getColor() { return ANSI.green.toString(); } } protected class Writer extends Consumer { Writer(int id) { super(id); } void getLock() throws InterruptedException { theLock = lock.getWriteLock(); } String getChannel() { return "WRITER"; } String getColor() { return ANSI.red.toString(); } } } 1.1 J4/src/java/gnu/j4/test/unit/SemaphoreGroup.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/SemaphoreGroup.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/SemaphoreGroup.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: SemaphoreGroup.java =================================================================== package gnu.j4.test.unit; import java.util.Hashtable; import gnu.j4.core.ANSI; import gnu.j4.service.ActiveService; import gnu.j4.service.PassiveService; import gnu.j4.service.Service; import gnu.j4.service.ServiceUnavailableException; import gnu.j4.sem.*; import gnu.j4.util.*; /** * This class implements a test of {@link gnu.j4.sem.SemaphoreGroup * SemaphoreGroup} class. * * <p> * * To understand what is really happening, pay attention to the object * identifiers in the log messages, and analyze the source code. * * <p> * * <h3>Known bugs</h3> * * Doesn't exit to the operating system after completion. But, since this is * a test anyway, it doesn't matter, though annoying. * * <pre> * $Log: SemaphoreGroup.java,v $ * Revision 1.1 2000/10/25 06:56:48 vt * Moved the files from gnu.j4.examples to gnu.j4.test.unit and * gnu.j4.test.integration, where they belong. * * Also, makeup changes and small fixes. * * Revision 1.11 2000/03/03 04:20:16 vt * Boom! Version bump. Finally happened, now it's time to recheck everything. * See details in ${srcdir}/ChangeLog. * * Revision 1.10.6.1 2000/03/02 06:30:55 vt * This commit was supposed to take care of the replacement of * * protected boolean XXX() throws InterruptedException * * with * * protected void XXX() throws InterruptedException, Throwable * * where XXX is (startup|execute|shutdown) in gnu.j4.PassiveService and all the * derived classes. * * Hopefully, it's over now - I've just replaced all the invocations in the * classes that are being compiled with the current configuration - that is, * lazy replacement. Where the logic changes were due, they were made. Now, * *that* wasn't exactly lazy ;/ * * Nevertheless, the extensive verification is on the way. * * Revision 1.10 1999/09/16 07:15:04 vt * Fixed a very annoying bug in the SemaphoreGroup.waitFor(*). Turned out to be * an Enumeration broken by the source Vector modification. Check out * SemaphoreGroup#checkBehind method. * * As a side effect, quite a few makeups, plus the 'known bugs' document. * * </pre> * @author <a href="mailto:vt...@fr...">Vadim Tkachenko</a> * @version $Id: SemaphoreGroup.java,v 1.1 2000/10/25 06:56:48 vt Exp $ */ public class SemaphoreGroup extends PassiveService implements TimerClient { /** * Log facility to use with this class. */ public static final String LOG_SGT = "SemaphoreGroup"; EventSemaphore EventSemaphore_A; EventSemaphore EventSemaphore_B; EventSemaphore EventSemaphore_C; TimerCallbackID timerCallback_A; TimerCallbackID timerCallback_B; TimerCallbackID timerCallback_C; /** * Callback to semaphore lookup table. */ Hashtable lookup; /** * Sequence number. * * Increments with every callback received, until reaches {@link #limit * limit}. Then the service stops. */ public int sequence = 0; /** * Number of repetitions. * * Hardcoded to 50. */ public final static int limit = 50; /** * Constructor. * <p> * Create three semaphores to add them to the group later. * @see gnu.j4.sem.EventSemaphore */ public SemaphoreGroup() { EventSemaphore_A = new EventSemaphore( this,"A" ); EventSemaphore_B = new EventSemaphore( this,"B" ); EventSemaphore_C = new EventSemaphore( this,"C" ); } /** * Startup. * <p> * Create and launch: * <ul> * <li>Semaphore trigger thread * <li>Thread to test {@link gnu.j4.sem.SemaphoreGroup#waitForOne waitForOne()} * <li>Thread to test {@link gnu.j4.sem.SemaphoreGroup#waitForAll waitForAll()} * @return true if all threads were launched successfully. * @exception InterruptedException if this thread was interrupted by * another thread. */ protected void startup() throws InterruptedException, Throwable { WaitForOne one = new WaitForOne( this ); WaitForAll all = new WaitForAll( this ); try { if ( !one.start().waitFor() ) { throw new ServiceUnavailableException("WaitForOne failed to start"); } } catch ( InterruptedException iex ) { complain( LOG_ERR,LOG_SGT,iex.toString()+" waiting for one-test" ); } try { if ( !all.start().waitFor() ) { throw new ServiceUnavailableException("WaitForAll failed to start"); } } catch ( InterruptedException iex ) { complain( LOG_ERR,LOG_SGT,iex.toString()+" waiting for all-test" ); } timerCallback_A = TimerCallback.start( this,(int)(Math.random() * 5000) ); timerCallback_B = TimerCallback.start( this,(int)(Math.random() * 5000) ); timerCallback_C = TimerCallback.start( this,(int)(Math.random() * 5000) ); lookup = new Hashtable(); lookup.put( timerCallback_A,EventSemaphore_A ); lookup.put( timerCallback_B,EventSemaphore_B ); lookup.put( timerCallback_C,EventSemaphore_C ); } /** * Process the timer callback. * * Look up the semaphore by callback and trigger it with a random value. * @param cb Timer callback identifier object. */ public synchronized void timerCallback( TimerCallbackID cb ) { complain( LOG_NOTICE,LOG_SGT,"Sequence: "+sequence ); if ( sequence++ > limit ) { stop(); } try { ((EventSemaphore)lookup.get( cb )).trigger( (Math.random()<0.5)?false:true ); } catch ( ClassCastException ccex ) { complain( LOG_WARNING,LOG_SGT,"unexpected callback: "+cb.toString(),ccex ); } catch ( NullPointerException npex ) { complain( LOG_WARNING,LOG_SGT,"unexpected callback: "+cb.toString(),npex ); } } /** * Stop the callbacks. * * @return <code>true</code>. * @exception InterruptedException if this thread was interrupted by * another thread. */ protected void shutdown() throws InterruptedException { complain( LOG_INFO,LOG_SGT,"stopping callback: "+timerCallback_A.toString() ); TimerCallback.stopCallback( timerCallback_A ); timerCallback_A = null; complain( LOG_INFO,LOG_SGT,"stopping callback: "+timerCallback_B.toString() ); TimerCallback.stopCallback( timerCallback_B ); timerCallback_B = null; complain( LOG_INFO,LOG_SGT,"stopping callback: "+timerCallback_C.toString() ); TimerCallback.stopCallback( timerCallback_C ); timerCallback_C = null; } /** * This class is actually a semaphore group holder. */ abstract class WaitFor extends ActiveService { /** * Group including all parent's semaphores. */ public gnu.j4.sem.SemaphoreGroup group; /** * Create new instance and add the parent's semaphores to the {@link * #group group}. * @parent Parent service. */ public WaitFor( SemaphoreGroup parent ) { parent.addDependant( this ); group = new gnu.j4.sem.SemaphoreGroup(); group.add( parent.EventSemaphore_A ); group.add( parent.EventSemaphore_B ); group.add( parent.EventSemaphore_C ); } /** * Do nothing. * * @return true. */ protected void startup() throws InterruptedException { } /** * Do nothing. * * @return true. */ protected void shutdown() throws InterruptedException { } } /** * This class' {@link #execute execute} method repeatedly invokes the * {@link gnu.j4.sem.SemaphoreGroup#waitForOne() * SemaphoreGroup.waitForOne()} method on the {@link #group group}, * until terminated. */ class WaitForOne extends WaitFor { /** * @deprecated * @see SemaphoreGroup.WaitForOne */ public WaitForOne( SemaphoreGroup parent ) { super( parent ); } /** * Keep waiting for the semaphore group and complaining about the * status. * * @exception InterruptedException if the thread was interrupted by * another thread. */ public void execute() throws InterruptedException { while ( isEnabled() ) { complain( LOG_NOTICE,LOG_SGT,ANSI.green+"got " + group.waitForOne().toString()+ANSI.white ); } } } /** * This class' {@link #execute execute} method repeatedly invokes the * {@link gnu.j4.sem.SemaphoreGroup#waitForAll() * SemaphoreGroup.waitForAll()} method on the {@link #group group}, * until terminated. */ class WaitForAll extends WaitFor { public WaitForAll( SemaphoreGroup parent ) { super( parent ); } /** * Keep waiting for the semaphore group and complaining about the * status. * * @exception InterruptedException if the thread was interrupted by * another thread. */ public void execute() throws InterruptedException { while ( isEnabled() ) { complain( LOG_NOTICE,LOG_SGT,ANSI.yellow+"got " + group.waitForAll(true)+ANSI.white ); } } } } 1.1 J4/src/java/gnu/j4/test/unit/ServerSocket.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/ServerSocket.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/ServerSocket.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: ServerSocket.java =================================================================== package gnu.j4.test.unit; import gnu.j4.sem.SemaphoreTimedOutException; import gnu.j4.service.ActiveService; import gnu.j4.service.ServiceUnavailableException; import gnu.j4.framework.server.net.SocketAcceptor; /** * A unit test for the bug related to <code>ServerSocket.accept()</code> * call on Linux. * * Fortunately, seems to have disappeared in either JDK 1.2 or JDK 1.3, so * this test is going to pass, unless you have a really old or weird JVM. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-2000 * @version $Id: ServerSocket.java,v 1.1 2000/10/25 06:56:48 vt Exp $ */ public class ServerSocket extends ActiveService { public static final String LOG_SST = "ServerSocketBug"; SocketAcceptor acceptor; protected void startup() throws InterruptedException, Throwable { acceptor = new SocketAcceptor(4999); if ( !acceptor.start().waitFor() ) { throw new ServiceUnavailableException("Socket acceptor failed to start"); } addDependant(acceptor); } protected void execute() throws InterruptedException { if ( System.getProperty("os.name").equals("Linux") ) { complain(LOG_WARNING, LOG_SST, "Prepare for the worst..."); } complain(LOG_NOTICE, LOG_SST, "Sleeping for 10 seconds..."); Thread.sleep(10000); complain(LOG_NOTICE, LOG_SST, "Trying to interrupt the acceptor..."); try { if ( !acceptor.stop().waitFor(2000) ) { complain(LOG_WARNING, LOG_SST, "Oh well. Can't stop it, it is not safe to use the socket connector on this platform."); } else { complain(LOG_NOTICE, LOG_SST, "Passed."); removeDependant(acceptor); } } catch ( SemaphoreTimedOutException stex ) { complain(LOG_WARNING, LOG_SST, "Timed out waiting 2 seconds for the acceptor to stop: " + stex.getMessage()); } } protected void shutdown() throws InterruptedException { if ( acceptor.isActive() ) { complain(LOG_NOTICE, LOG_SST, "Oops, the bug is here. You should press Ctrl-C now, we're hung."); } } } 1.1 J4/src/java/gnu/j4/test/unit/ThreadTest.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/ThreadTest.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/ThreadTest.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: ThreadTest.java =================================================================== package gnu.j4.test.unit; import gnu.j4.service.ActiveService; import gnu.j4.util.DataSequence; /** * Stress test for the number of threads that can be launched. * * @since Jukebox 3 * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1005-1998 * @version $Id: ThreadTest.java,v 1.1 2000/10/25 06:56:48 vt Exp $ */ public class ThreadTest extends ActiveService { static public final int startDelay = 100; static int totalThreads = 0; static DataSequence register = new DataSequence(); protected long ctime = System.currentTimeMillis(); public ThreadTest() { } protected void startup() throws InterruptedException { } protected void shutdown() throws InterruptedException { } protected void execute() throws InterruptedException { Thread.sleep( startDelay ); (new ThreadTest()).start(); long lag = (System.currentTimeMillis() - ctime) - startDelay; register.add( lag ); complain(LOG_NOTICE, "ThreadTest", "running/" + (++totalThreads) + " lag " + lag + " " + register.toString()); // flushLog(); while ( isEnabled() ) { Thread.sleep( 1000 ); // complain( Log.DEBUG,"active" ); } } } 1.1 J4/src/java/gnu/j4/test/unit/VectorVsStringSearch.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/VectorVsStringSearch.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/VectorVsStringSearch.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: VectorVsStringSearch.java =================================================================== package gnu.j4.test.unit; import java.util.Enumeration; import java.util.Vector; import gnu.j4.core.LogAware; public class VectorVsStringSearch extends LogAware { public static final int COUNT = 10000; public static void main(String args[]) { (new VectorVsStringSearch()).run(); } public void run() { Vector v = new Vector(); v.addElement( "This is a sentence number 01" ); v.addElement( "This is a sentence number 02" ); v.addElement( "This is a sentence number 03" ); v.addElement( "This is a sentence number 04" ); v.addElement( "This is a sentence number 05" ); v.addElement( "This is a sentence number 06" ); v.addElement( "This is a sentence number 07" ); v.addElement( "This is a sentence number 08" ); v.addElement( "This is a sentence number 09" ); v.addElement( "This is a sentence number 10" ); v.addElement( "This is a sentence number 11" ); v.addElement( "This is a sentence number 12" ); v.addElement( "This is a sentence number 13" ); v.addElement( "This is a sentence number 14" ); v.addElement( "This is a sentence number 15" ); v.addElement( "This is a sentence number 16" ); v.addElement( "This is a sentence number 17" ); v.addElement( "This is a sentence number 18" ); v.addElement( "This is a sentence number 19" ); v.addElement( "This is a sentence number 20" ); String summary = ""; for ( Enumeration e = v.elements(); e.hasMoreElements(); ) { summary += " " + e.nextElement().toString(); } long start1 = System.currentTimeMillis(); int found = 0; String match = v.elementAt( 19 ).toString(); for ( int idx = 0; idx < COUNT; idx++ ) { found = v.indexOf(match); } long stop1 = System.currentTimeMillis(), start2 = stop1; for ( int idx = 0; idx < COUNT; idx++ ) { found = summary.indexOf(match); } long stop2 = System.currentTimeMillis(), span1 = stop1-start1, span2 = stop2 -start2; double dspan1 = (double)span1/1000L, dspan2 = (double)span2/1000L; complain(LOG_NOTICE, "vector", Long.toString(span1) + "(" + (dspan1/(double)COUNT) + "/sec)"); complain(LOG_NOTICE, "string", Long.toString(span2) + "(" + (dspan2/(double)COUNT) + "/sec)"); gnu.j4.core.Logger.close(); } } 1.1 J4/src/java/gnu/j4/test/unit/package.html CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/package.html?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/unit/package.html?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: package.html =================================================================== <body> This package contains the unit tests for the different Jukebox components. </body> |
From: CVS B. <vt...@fr...> - 2000-10-25 06:56:52
|
User: vt Date: 00/10/24 23:56:50 Modified: src/scripts .cvsignore Makefile.am Removed: src/scripts ejbserver.in j4wrapper.in Log: Moved the files from gnu.j4.examples to gnu.j4.test.unit and gnu.j4.test.integration, where they belong. Also, makeup changes and small fixes. Revision Changes Path 1.3 +0 -2 J4/src/scripts/.cvsignore CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/.cvsignore?annotate=1.3&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/.cvsignore?rev=1.3&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/.cvsignore.diff?r1=1.3&r2=1.2&cvsroot=jukebox4 ----------------------------------- Index: .cvsignore =================================================================== RCS file: /usr/local/cvs/J4/src/scripts/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- .cvsignore 1999/08/12 22:09:06 1.2 +++ .cvsignore 2000/10/25 06:56:49 1.3 @@ -1,4 +1,2 @@ Makefile Makefile.in -j4wrapper -ejbserver 1.5 +2 -22 J4/src/scripts/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/Makefile.am?annotate=1.5&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/Makefile.am?rev=1.5&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/Makefile.am.diff?r1=1.5&r2=1.4&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/src/scripts/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Makefile.am 2000/07/06 10:47:09 1.4 +++ Makefile.am 2000/10/25 06:56:49 1.5 @@ -1,29 +1,9 @@ -# $Id: Makefile.am,v 1.4 2000/07/06 10:47:09 vt Exp $ +# $Id: Makefile.am,v 1.5 2000/10/25 06:56:49 vt Exp $ -bin_PROGRAMS = j4wrapper ejbserver +SUBDIRS = test run -j4wrapper_SOURCES = j4wrapper - -if EJB - -ejbserver_SOURCES = ejbserver - -else - -ejbserver_SOURCES = - -endif - RM = @RM@ clean-generic: ${RM} -f *~ .*~ - -j4wrapper: - -if EJB - -ejbserver: - -endif |
From: CVS B. <vt...@fr...> - 2000-10-25 06:56:52
|
User: vt Date: 00/10/24 23:56:50 Added: src/scripts/test .cvsignore LruCache.in Makefile.am RWLock.in SemaphoreGroup.in Log: Moved the files from gnu.j4.examples to gnu.j4.test.unit and gnu.j4.test.integration, where they belong. Also, makeup changes and small fixes. Revision Changes Path 1.1 J4/src/scripts/test/.cvsignore CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/test/.cvsignore?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/test/.cvsignore?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: .cvsignore =================================================================== Makefile Makefile.in LruCache SemaphoreGroup RWLock .deps 1.1 J4/src/scripts/test/LruCache.in CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/test/LruCache.in?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/test/LruCache.in?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: LruCache.in =================================================================== #! /bin/sh # This test runs the gnu.j4.examples.LruCacheTest class. # # The output you get depends on the default settings, so please read the # configuration files in @prefix@/etc carefully so you understand what's # going on. @prefix@/bin/j4wrapper gnu.j4.examples.LruCacheTest 1.1 J4/src/scripts/test/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/test/Makefile.am?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/test/Makefile.am?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== # $Id: Makefile.am,v 1.1 2000/10/25 06:56:50 vt Exp $ bin_PROGRAMS = LruCache \ SemaphoreGroup \ RWLock bindir = ${prefix}/test/bin LruCache_SOURCES = LruCache SemaphoreGroup_SOURCES = SemaphoreGroup RWLock_SOURCES = RWLock RM = @RM@ clean-generic: ${RM} -f *~ .*~ LruCache: SemaphoreGroup: RWLock: 1.1 J4/src/scripts/test/RWLock.in CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/test/RWLock.in?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/test/RWLock.in?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: RWLock.in =================================================================== #! /bin/sh # This test runs the gnu.j4.examples.RWLockTest class. # # The output you get depends on the default settings, so please read the # configuration files in @prefix@/etc carefully so you understand what's # going on. @prefix@/bin/j4wrapper gnu.j4.examples.RWLockTest 1.1 J4/src/scripts/test/SemaphoreGroup.in CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/test/SemaphoreGroup.in?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/test/SemaphoreGroup.in?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: SemaphoreGroup.in =================================================================== #! /bin/sh # This test runs the gnu.j4.examples.SemaphoreGroupTest class. # # The output you get depends on the default settings, so please read the # configuration files in @prefix@/etc carefully so you understand what's # going on. @prefix@/bin/j4wrapper gnu.j4.examples.SemaphoreGroupTest |
From: CVS B. <vt...@fr...> - 2000-10-25 06:56:47
|
User: vt Date: 00/10/24 23:56:47 Modified: src/java/gnu/j4 Makefile.am Log: Moved the files from gnu.j4.examples to gnu.j4.test.unit and gnu.j4.test.integration, where they belong. Also, makeup changes and small fixes. Revision Changes Path 1.11 +2 -2 J4/src/java/gnu/j4/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/Makefile.am?annotate=1.11&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/Makefile.am?rev=1.11&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/Makefile.am.diff?r1=1.11&r2=1.10&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Makefile.am 2000/07/06 10:47:03 1.10 +++ Makefile.am 2000/10/25 06:56:47 1.11 @@ -1,6 +1,6 @@ -# $Id: Makefile.am,v 1.10 2000/07/06 10:47:03 vt Exp $ +# $Id: Makefile.am,v 1.11 2000/10/25 06:56:47 vt Exp $ -SUBDIRS = cache config core examples jmx mail sem getopt service util framework io net ejb +SUBDIRS = cache config core examples jmx mail sem getopt service util framework io net ejb test EXTRA_DIST = package.html |
From: CVS B. <vt...@fr...> - 2000-10-25 06:56:46
|
User: vt Date: 00/10/24 23:56:48 Added: src/java/gnu/j4/test/integration .cvsignore Makefile.am ResourcePool.java ResourcePoolFailure.java package.html Log: Moved the files from gnu.j4.examples to gnu.j4.test.unit and gnu.j4.test.integration, where they belong. Also, makeup changes and small fixes. Revision Changes Path 1.1 J4/src/java/gnu/j4/test/integration/.cvsignore CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/integration/.cvsignore?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/integration/.cvsignore?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: .cvsignore =================================================================== Makefile Makefile.in LocalConfig.java *.class .deps 1.1 J4/src/java/gnu/j4/test/integration/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/integration/Makefile.am?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/integration/Makefile.am?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== # $Id: Makefile.am,v 1.1 2000/10/25 06:56:48 vt Exp $ EXTRA_DIST = package.html noinst_PROGRAMS = package package_SOURCES = ResourcePool.java \ ResourcePoolFailure.java ECHO = @ECHO@ JAVACX = @JAVACX@ RM = @RM@ SUFFIXES = .java .class .java.class: - @ ${ECHO} "Making $<" @ ${JAVACX} $< package: $(package_OBJECTS) $(package_DEPENDENCIES) clean-compile: ${RM} -f *.class clean-generic: ${RM} -f *~ .*~ 1.1 J4/src/java/gnu/j4/test/integration/ResourcePool.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/integration/ResourcePool.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/integration/ResourcePool.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: ResourcePool.java =================================================================== package gnu.j4.examples; import java.util.Random; import gnu.j4.config.Configuration; import gnu.j4.sem.SemaphoreGroup; import gnu.j4.service.ActiveService; import gnu.j4.service.Service; import gnu.j4.service.PassiveService; import gnu.j4.service.ServiceUnavailableException; /** * Resource pool unit test and example. * * <ol> * * <li>Create and start the resource pool. * * <li>Create and start a number of consumers, randomly requesting the * resources from the pool. * * <li>Let it work for a while. * * <li>Stop everything. * * </ol> * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1998 * @version $Id: ResourcePool.java,v 1.1 2000/10/25 06:56:48 vt Exp $ */ public class ResourcePool extends ActiveService { /** * Log facility to use for this class. */ public static final String LOG_RPT = "RPT"; /** * Serial number of the consumer thread. */ protected static int TID = 0; /** * Sample resource pool. */ protected gnu.j4.service.ResourcePool pool; /** * Master configuration. */ protected Configuration conf; /** * Random generator. * * I have to use this to make this example compile under JDK 1.1. * * @see #random */ protected Random R = new Random(); /** * Semaphore group that is used to track the consumer object shutdowns. */ protected SemaphoreGroup done = new SemaphoreGroup(); /** * The configuration keyword to extract the minimum number of spare * services to start. */ public static final String CF_MIN_START = "test.resource.pool.minstart"; /** * The configuration keyword to extract the maximum possible number of * services to run. */ public static final String CF_MAX_KEEP = "test.resource.pool.maxkeep"; /** * The configuration keyword to extract the minimum number of spares to * keep. */ public static final String CF_MIN_SPARES = "test.resource.pool.minspares"; /** * The configuration keyword to extract the maximum number of spares to * keep. */ public static final String CF_MAX_SPARES = "test.resource.pool.maxspares"; /** * The configuration keyword to extract the maximum number of calls to * hit the resources with. */ public static final String CF_LIMIT_THREAD = "test.resource.pool.threadcount"; /** * The configuration keyword to extract the maximum number of calls to * hit the resources with. */ public static final String CF_LIMIT_HIT = "test.resource.pool.hitcount"; /** * The configuration keyword to extract the maximum delay before * requesting the resource. */ public static final String CF_ATTACK = "test.resource.pool.attack"; /** * The configuration keyword to extract the maximum time to hold the * resource. */ public static final String CF_SUSTAIN = "test.resource.pool.sustain"; /** * The idiot-proof test variable. * * Tracks the resource consumption. Should never exceed the value set * for the {@link #CF_MAX_KEEP maxKeep}. */ protected int resourceInstanceCount = 0; /** * Start the resource pool, then the resource consumers. * * @return true * @exception InterruptedException if this thread was interrupted by * another thread. */ protected void startup() throws InterruptedException, Throwable { Configuration defaultConf = new Configuration(); defaultConf.put(CF_MIN_START, "3"); defaultConf.put(CF_MAX_KEEP, "10"); defaultConf.put(CF_MIN_SPARES, "2"); defaultConf.put(CF_MAX_SPARES, "5"); defaultConf.put(CF_LIMIT_THREAD, "100"); defaultConf.put(CF_LIMIT_HIT, "100"); defaultConf.put(CF_ATTACK, "1000"); defaultConf.put(CF_SUSTAIN, "200"); conf = Configuration.createChain("test.resource.pool.conf", defaultConf); pool = new Pool(conf.getInteger(CF_MIN_START), conf.getInteger(CF_MAX_KEEP), conf.getInteger(CF_MIN_SPARES), conf.getInteger(CF_MAX_SPARES)); if ( !pool.start().waitFor() ) { throw new ServiceUnavailableException("Couldn't start the resource pool"); } complain(LOG_WARNING, LOG_RPT, pool.toString()); complain(LOG_WARNING, LOG_RPT, "Threads: " + conf.getInteger(CF_LIMIT_THREAD)); complain(LOG_WARNING, LOG_RPT, "Hits: " + conf.getInteger(CF_LIMIT_HIT)); complain(LOG_WARNING, LOG_RPT, "Attack: " + conf.getInteger(CF_ATTACK)); complain(LOG_WARNING, LOG_RPT, "Sustain: " + conf.getInteger(CF_SUSTAIN)); addDependant(pool); for ( int idx = 0; idx < conf.getInteger(CF_LIMIT_THREAD); idx++ ) { Consumer c = new Consumer(); c.start(); addDependant(c); done.add(c.getSemDown()); } complain( LOG_WARNING,LOG_RPT,"startup OK" ); } /** * Fake the successful execution. * * Log a message, return success. * * @return true * @exception InterruptedException if this thread was interrupted by * another thread. */ protected void execute() throws InterruptedException { complain(LOG_WARNING, LOG_RPT, "Pinging the resource pool with the requests"); done.waitForAll(); complain(LOG_WARNING, LOG_RPT, "The consumer services have finished."); } /** * Shut down everything, implicitly. * * @return true * @exception InterruptedException if this thread was interrupted by * another thread. */ protected void shutdown() throws InterruptedException { complain( LOG_NOTICE,LOG_RPT,"shutdown: cleaning up" ); } protected int random(int limit) { int r = R.nextInt(); if ( r < 0 ) { r = -r; } return (r % limit); } protected class Consumer extends ActiveService { protected int tid; protected void startup() throws InterruptedException { tid = TID++; } protected void execute() throws InterruptedException, Throwable { int REQUEST_COUNT = conf.getInteger(CF_LIMIT_HIT); for ( int idx = 0; idx < REQUEST_COUNT; idx++ ) { Thread.sleep(random(conf.getInteger(CF_ATTACK))); complain(LOG_NOTICE, LOG_RPT, "REQ(" + tid + "), " + idx + " out of " + REQUEST_COUNT); Service s = pool.getResource(); complain(LOG_NOTICE, LOG_RPT, "GOT(" + tid + ")"); Thread.sleep(random(conf.getInteger(CF_SUSTAIN))); complain(LOG_NOTICE, LOG_RPT, "REL(" + tid + ")"); pool.releaseResource(s); } } protected void shutdown() throws InterruptedException { } } protected class Pool extends gnu.j4.service.ResourcePool { public Pool(int minStart, int maxKeep, int minSpare, int maxSpare) { super(minStart, maxKeep, minSpare, maxSpare); } protected Service createResource() { return new SampleResource(); } protected class SampleResource extends PassiveService { protected String LOG_SR = "SampleResource"; protected void startup() throws InterruptedException, Throwable { this.complain(LOG_INFO, LOG_SR, "starting up"); if ( ++resourceInstanceCount > conf.getInteger(CF_MAX_KEEP) ) { throw new ServiceUnavailableException("INCONSISTENCY: MAX_KEEP EXCEEDED"); } } protected void shutdown() throws InterruptedException { this.complain(LOG_INFO, LOG_SR, "shutting down"); resourceInstanceCount--; } } } } 1.1 J4/src/java/gnu/j4/test/integration/ResourcePoolFailure.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/integration/ResourcePoolFailure.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/integration/ResourcePoolFailure.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: ResourcePoolFailure.java =================================================================== package gnu.j4.examples; import gnu.j4.service.ActiveService; import gnu.j4.service.PassiveService; import gnu.j4.service.Service; import gnu.j4.service.ServiceUnavailableException; /** * Resource pool stress test. * * Checks if the resource pool can handle the situations when several, up to * all, of the poolable services fail. * * <p> * * Expected behavior: the resource pool is supposed to start successfully * only if <strong>all</strong> resources have started successfully. Let's * be paranoid. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 2000 * @version $Id: ResourcePoolFailure.java,v 1.1 2000/10/25 06:56:48 vt Exp $ */ public class ResourcePoolFailure extends ActiveService { /** * Log facility to use. */ public static final String CH_FT = "FailureTest"; /** * Resource count. * * Every time the {@link ResourcePoolFailure.Pool.FailingResource * FailingResource} starts, it decrements this variable. If it is * already zero, it refuses to start. */ protected static int rCount = 15; static synchronized int getResourceCount() { return rCount--; } /** * Do nothing here, because we'll have to start and stop the service * twice. */ protected void startup() { } /** * Test the service. * * <ul> * * <li> First time, start it and make <strong>all</strong> the poolable * services fail the startup. * * <li> Second time, make <strong>some</strong> poolable services fail * the startup. */ protected void execute() throws Throwable { gnu.j4.service.ResourcePool pool = new Pool(); // This one is going to start if ( pool.start().waitFor() ) { complain(LOG_NOTICE, CH_FT, "started as expected"); } else { complain(LOG_ALERT, CH_FT, "failed: shouldn't have"); } Thread.sleep(5000); pool.stop(); // This one is going to fail because not all the resources have // started up if ( !pool.start().waitFor() ) { complain(LOG_NOTICE, "FailureTest", "failed as expected"); } else { complain(LOG_ALERT, CH_FT, "started: shouldn't have"); } Thread.sleep(5000); pool.stop(); // This one is going to fail as well pool = new Pool(); pool.start().waitFor(); if ( !pool.start().waitFor() ) { complain(LOG_NOTICE, "FailureTest", "failed as expected"); } else { complain(LOG_ALERT, CH_FT, "started: shouldn't have"); } } /** * Do nothing. */ protected void shutdown() { } protected class Pool extends gnu.j4.service.ResourcePool { /** * Create the instance. * * @param minStart Minimum number of poolable resources to start. */ public Pool() { super(10, 20, 5, 5); } protected Service createResource() { return new FailingResource(); } protected class FailingResource extends PassiveService { protected synchronized void startup() throws Throwable { int rCount = getResourceCount(); complain(LOG_INFO, "Failer/startup", "" + rCount + " resources left"); if ( rCount <= 0 ) { throw new ServiceUnavailableException("No more resources"); } } protected void shutdown() { complain(LOG_INFO, "Failer", "shut down."); } } } } 1.1 J4/src/java/gnu/j4/test/integration/package.html <<Binary file>> |
From: CVS B. <vt...@fr...> - 2000-10-25 06:56:44
|
User: vt Date: 00/10/24 23:56:48 Added: src/java/gnu/j4/test .cvsignore Makefile.am package.html Log: Moved the files from gnu.j4.examples to gnu.j4.test.unit and gnu.j4.test.integration, where they belong. Also, makeup changes and small fixes. Revision Changes Path 1.1 J4/src/java/gnu/j4/test/.cvsignore CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/.cvsignore?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/.cvsignore?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: .cvsignore =================================================================== Makefile Makefile.in LocalConfig.java *.class .deps 1.1 J4/src/java/gnu/j4/test/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/Makefile.am?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/test/Makefile.am?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== # $Id: Makefile.am,v 1.1 2000/10/25 06:56:48 vt Exp $ SUBDIRS = integration unit EXTRA_DIST = package.html ECHO = @ECHO@ JAVACX = @JAVACX@ RM = @RM@ SUFFIXES = .java .class .java.class: - @ ${ECHO} "Making $<" @ ${JAVACX} $< package: $(package_OBJECTS) $(package_DEPENDENCIES) clean-compile: ${RM} -f *.class clean-generic: ${RM} -f *~ .*~ 1.1 J4/src/java/gnu/j4/test/package.html <<Binary file>> |
From: CVS B. <vt...@fr...> - 2000-10-25 06:56:42
|
User: vt Date: 00/10/24 23:56:47 Modified: . Makefile.am configure.in Log: Moved the files from gnu.j4.examples to gnu.j4.test.unit and gnu.j4.test.integration, where they belong. Also, makeup changes and small fixes. Revision Changes Path 1.26 +5 -3 J4/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/Makefile.am?annotate=1.26&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/Makefile.am?rev=1.26&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/Makefile.am.diff?r1=1.26&r2=1.25&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/Makefile.am,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- Makefile.am 2000/08/24 20:35:48 1.25 +++ Makefile.am 2000/10/25 06:56:46 1.26 @@ -1,11 +1,11 @@ ## Makefile.am: top level automake makefile for Jukebox. ## Process this file with automake to get Makefile.in ## -## $Id: Makefile.am,v 1.25 2000/08/24 20:35:48 vt Exp $ +## $Id: Makefile.am,v 1.26 2000/10/25 06:56:46 vt Exp $ # Makefile.in: top level autoconf makefile for Jukebox. # -# $Id: Makefile.am,v 1.25 2000/08/24 20:35:48 vt Exp $ +# $Id: Makefile.am,v 1.26 2000/10/25 06:56:46 vt Exp $ AUTOMAKE_OPTIONS = gnu @@ -69,7 +69,9 @@ gnu.j4.io.storage.fs \ gnu.j4.net \ gnu.j4.net.telnet \ - gnu.j4.jmx + gnu.j4.jmx \ + gnu.j4.test.unit \ + gnu.j4.test.integration # The XXX_PACKAGES define the optional components 1.67 +11 -6 J4/configure.in CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/configure.in?annotate=1.67&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/configure.in?rev=1.67&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/configure.in.diff?r1=1.67&r2=1.66&cvsroot=jukebox4 ----------------------------------- Index: configure.in =================================================================== RCS file: /usr/local/cvs/J4/configure.in,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- configure.in 2000/09/13 20:14:53 1.66 +++ configure.in 2000/10/25 06:56:46 1.67 @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_REVISION($Id: configure.in,v 1.66 2000/09/13 20:14:53 vt Exp $)dnl +AC_REVISION($Id: configure.in,v 1.67 2000/10/25 06:56:46 vt Exp $)dnl dnl I'd like it to read the ./configure-options to allow both the basic set dnl of options, as well as the local set. @@ -30,6 +30,7 @@ VERSION_MAJOR="2" VERSION_MINOR="1" PATCHLEVEL="0" + AC_SUBST(VERSION_MAJOR)dnl AC_SUBST(VERSION_MINOR)dnl AC_SUBST(PATCHLEVEL)dnl @@ -428,11 +429,8 @@ examples/index.html examples/exampleConfigTest examples/exampleLogTest - examples/exampleLruCacheTest examples/exampleResourcePoolTest examples/exampleResourcePoolFailureTest - examples/exampleRWLockTest - examples/exampleSemaphoreGroupTest examples/exampleSimpleServiceTest examples/exampleTelnetTest examples/exampleXmlConfigurationTest @@ -466,14 +464,21 @@ src/java/gnu/j4/net/Makefile src/java/gnu/j4/net/ldap/Makefile src/java/gnu/j4/net/telnet/Makefile + src/java/gnu/j4/test/Makefile + src/java/gnu/j4/test/integration/Makefile + src/java/gnu/j4/test/unit/Makefile src/java/gnu/j4/Makefile src/java/gnu/j4/LocalConfig.java src/java/gnu/Makefile src/java/Makefile src/Makefile src/scripts/Makefile - src/scripts/j4wrapper - src/scripts/ejbserver + src/scripts/run/Makefile + src/scripts/run/j4wrapper + src/scripts/run/ejbserver + src/scripts/test/Makefile + src/scripts/test/LruCache + src/scripts/test/SemaphoreGroup Makefile ) |
User: vt Date: 00/10/24 23:56:48 Modified: src/java/gnu/j4/examples Makefile.am Removed: src/java/gnu/j4/examples ChunkedOutputTest.java LruCacheTest.java RWLockTest.java ResourcePoolFailureTest.java ResourcePoolTest.java SemaphoreGroupTest.java ServerSocketTest.java ThreadTest.java VvsStest.java Log: Moved the files from gnu.j4.examples to gnu.j4.test.unit and gnu.j4.test.integration, where they belong. Also, makeup changes and small fixes. Revision Changes Path 1.24 +2 -10 J4/src/java/gnu/j4/examples/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/Makefile.am?annotate=1.24&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/Makefile.am?rev=1.24&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/Makefile.am.diff?r1=1.24&r2=1.23&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/examples/Makefile.am,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- Makefile.am 2000/08/24 20:35:50 1.23 +++ Makefile.am 2000/10/25 06:56:48 1.24 @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.23 2000/08/24 20:35:50 vt Exp $ +# $Id: Makefile.am,v 1.24 2000/10/25 06:56:48 vt Exp $ noinst_PROGRAMS = package @@ -6,20 +6,12 @@ ClientTest.java \ ConfigTest.java \ ChunkedClientTest.java \ - ChunkedOutputTest.java \ ChunkedServletTest.java \ - LruCacheTest.java \ - ResourcePoolTest.java \ - ResourcePoolFailureTest.java \ - SemaphoreGroupTest.java \ - ServerSocketTest.java \ ServerTest.java \ SimpleService.java \ StreamClientTest.java \ StreamServerTest.java \ - TelnetTest.java \ - ThreadTest.java \ - VvsStest.java + TelnetTest.java JAVA2_FILES = LogTest.java \ RWLockTest.java |
From: CVS B. <vt...@fr...> - 2000-10-25 06:56:42
|
User: vt Date: 00/10/24 23:56:47 Modified: examples Makefile.am Removed: examples exampleLruCacheTest.in exampleRWLockTest.in exampleSemaphoreGroupTest.in Log: Moved the files from gnu.j4.examples to gnu.j4.test.unit and gnu.j4.test.integration, where they belong. Also, makeup changes and small fixes. Revision Changes Path 1.11 +2 -2 J4/examples/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/Makefile.am?annotate=1.11&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/Makefile.am?rev=1.11&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/Makefile.am.diff?r1=1.11&r2=1.10&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/examples/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Makefile.am 2000/08/24 20:41:09 1.10 +++ Makefile.am 2000/10/25 06:56:47 1.11 @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.10 2000/08/24 20:41:09 vt Exp $ +# $Id: Makefile.am,v 1.11 2000/10/25 06:56:47 vt Exp $ bin_PROGRAMS = exampleLogTest \ exampleLruCacheTest \ @@ -13,7 +13,7 @@ bin_DATA = index.html -bindir = ${prefix}/examples +bindir = ${prefix}/docs/examples exampleLogTest_SOURCES = exampleLogTest exampleLruCacheTest_SOURCES = exampleLruCacheTest |
From: CVS B. <vt...@fr...> - 2000-10-25 06:56:40
|
User: vt Date: 00/10/24 23:56:47 Modified: etc Makefile.am test.conf.in test.resource.pool.conf.in Log: Moved the files from gnu.j4.examples to gnu.j4.test.unit and gnu.j4.test.integration, where they belong. Also, makeup changes and small fixes. Revision Changes Path 1.6 +5 -2 J4/etc/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/etc/Makefile.am?annotate=1.6&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/etc/Makefile.am?rev=1.6&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/etc/Makefile.am.diff?r1=1.6&r2=1.5&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/etc/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Makefile.am 2000/08/24 20:35:49 1.5 +++ Makefile.am 2000/10/25 06:56:47 1.6 @@ -1,7 +1,10 @@ -# $Id: Makefile.am,v 1.5 2000/08/24 20:35:49 vt Exp $ +# $Id: Makefile.am,v 1.6 2000/10/25 06:56:47 vt Exp $ etcdir = ${prefix}/etc -etc_DATA = log.conf test.conf test.resource.pool.conf management.conf jukebox.conf.xml jukebox.conf.dtd +etc_DATA = log.conf management.conf jukebox.conf.xml jukebox.conf.dtd + +test_etcdir = ${prefix}/test/etc +test_etc_DATA = test.conf test.resource.pool.conf RM = @RM@ 1.4 +7 -7 J4/etc/test.conf.in CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/etc/test.conf.in?annotate=1.4&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/etc/test.conf.in?rev=1.4&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/etc/test.conf.in.diff?r1=1.4&r2=1.3&cvsroot=jukebox4 ----------------------------------- Index: test.conf.in =================================================================== RCS file: /usr/local/cvs/J4/etc/test.conf.in,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- test.conf.in 1999/06/29 04:35:34 1.3 +++ test.conf.in 2000/10/25 06:56:47 1.4 @@ -1,15 +1,15 @@ -# $Id: test.conf.in,v 1.3 1999/06/29 04:35:34 vt Exp $ +# $Id: test.conf.in,v 1.4 2000/10/25 06:56:47 vt Exp $ # This file is the global configuration file for the # gnu.j4.examples.ConfigTest class. There should be three such files: # -# @prefix@/etc/test.conf -# $HOME/.jukebox/test/.conf -# test.conf file in the directory you run the test in. +# @prefix@/etc/test/test.conf +# $HOME/.jukebox/test.conf +# .test.conf file in the directory you run the test in. # # You can play with these files and see what happens if you specify # different values for the same names. -GLOBAL=This value is defined in @prefix@/etc/test.conf -HOME=This value is defined in @prefix@/etc/test.conf -LOCAL=This value is defined in @prefix@/etc/test.conf +GLOBAL=This value is defined in @prefix@/test/etc/test.conf +HOME=This value is defined in @prefix@/test/etc/test.conf +LOCAL=This value is defined in @prefix@/test/etc/test.conf 1.2 +1 -1 J4/etc/test.resource.pool.conf.in CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/etc/test.resource.pool.conf.in?annotate=1.2&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/etc/test.resource.pool.conf.in?rev=1.2&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/etc/test.resource.pool.conf.in.diff?r1=1.2&r2=1.1&cvsroot=jukebox4 ----------------------------------- Index: test.resource.pool.conf.in =================================================================== RCS file: /usr/local/cvs/J4/etc/test.resource.pool.conf.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- test.resource.pool.conf.in 1999/11/16 23:09:31 1.1 +++ test.resource.pool.conf.in 2000/10/25 06:56:47 1.2 @@ -1,5 +1,5 @@ # Configuration file for the gnu.j4.examples.ResourcePoolTest class, a.k.a -# ${jukebox}/examples/exampleResourcePoolTest. +# ${jukebox}/src/scripts/test/ResourcePool. # This test gives me hard time on my RedHat 5.2 glibc2.1 box. The JVM keeps # freezing all the time (not the test, the JVM. Try the Ctrl-\ next time you |
From: CVS B. <vt...@fr...> - 2000-10-25 06:56:40
|
User: vt Date: 00/10/24 23:56:47 Modified: docs/apidocs index-template.html Log: Moved the files from gnu.j4.examples to gnu.j4.test.unit and gnu.j4.test.integration, where they belong. Also, makeup changes and small fixes. Revision Changes Path 1.10 +1 -1 J4/docs/apidocs/index-template.html CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/docs/apidocs/index-template.html?annotate=1.10&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/docs/apidocs/index-template.html?rev=1.10&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/docs/apidocs/index-template.html.diff?r1=1.10&r2=1.9&cvsroot=jukebox4 ----------------------------------- Index: index-template.html =================================================================== RCS file: /usr/local/cvs/J4/docs/apidocs/index-template.html,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- index-template.html 2000/08/24 21:22:35 1.9 +++ index-template.html 2000/10/25 06:56:47 1.10 @@ -2,7 +2,7 @@ <!--NewPage--> <HTML> <HEAD> -<!-- Generated by javadoc on Thu Aug 24 13:45:12 MST 2000--> +<!-- Generated by javadoc on Tue Oct 24 21:14:06 MST 2000--> <TITLE> Generated Documentation (Untitled) </TITLE> |
From: CVS B. <vt...@fr...> - 2000-10-25 06:54:48
|
User: vt Date: 00/10/24 23:54:52 Modified: src/java/gnu/j4/examples Base64Example.java Log: Made the check return the error code to the system if the check is not successful. Revision Changes Path 1.3 +16 -3 J4/src/java/gnu/j4/examples/Base64Example.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/Base64Example.java?annotate=1.3&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/Base64Example.java?rev=1.3&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/Base64Example.java.diff?r1=1.3&r2=1.2&cvsroot=jukebox4 ----------------------------------- Index: Base64Example.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/examples/Base64Example.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Base64Example.java 2000/08/04 23:21:07 1.2 +++ Base64Example.java 2000/10/25 06:54:52 1.3 @@ -15,7 +15,7 @@ * MIME Base64 encoding/decoding example. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1998 - * @version $Id: Base64Example.java,v 1.2 2000/08/04 23:21:07 vt Exp $ + * @version $Id: Base64Example.java,v 1.3 2000/10/25 06:54:52 vt Exp $ */ public class Base64Example extends ActiveService { @@ -56,9 +56,16 @@ sources.add("Padding1234"); sources.add("Padding12345"); + boolean OK = true; + for ( Enumeration e = sources.elements(); e.hasMoreElements(); ) { + + OK = process((String)e.nextElement())?OK:false; + } - process((String)e.nextElement()); + if ( !OK ) { + + throw new Error("FAILED"); } } @@ -72,8 +79,10 @@ LOG_NOTICE,CH_BASE64,"shutdown: cleaning up" ); } - private void process(String source) throws Throwable { + private boolean process(String source) throws Throwable { + boolean OK = true; + complain(LOG_NOTICE, CH_BASE64, "Source: '" + source + "'"); ByteArrayInputStream in = new ByteArrayInputStream(source.getBytes()); @@ -128,6 +137,7 @@ if ( !encodedReliable.equals(encoded) ) { complain(LOG_ERR, CH_BASE64, "FAILED: '" + encodedReliable + "', length " + encodedReliable.length()); + OK = false; } in = new ByteArrayInputStream(encoded.getBytes()); @@ -159,7 +169,10 @@ if ( !source.equals(decoded) ) { complain(LOG_ERR, CH_BASE64, "FAILED: '" + source + "', length " + source.length()); + OK = false; } + + return OK; } } |
From: CVS B. <vt...@fr...> - 2000-10-25 06:18:09
|
User: vt Date: 00/10/24 23:18:04 Modified: src/java Makefile.am Log: Archive wasn't being updated properly. Fixed. Revision Changes Path 1.22 +7 -3 J4/src/java/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/Makefile.am?annotate=1.22&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/Makefile.am?rev=1.22&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/Makefile.am.diff?r1=1.22&r2=1.21&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/src/java/Makefile.am,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- Makefile.am 2000/07/09 01:14:49 1.21 +++ Makefile.am 2000/10/25 06:18:03 1.22 @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.21 2000/07/09 01:14:49 vt Exp $ +# $Id: Makefile.am,v 1.22 2000/10/25 06:18:03 vt Exp $ SUBDIRS = gnu EXTRA_DIST = package.html @@ -32,8 +32,12 @@ if REX -.PHONY: rex +.PHONY: ${ARCHIVE} rex +else + +.PHONY: ${ARCHIVE} + endif if REX @@ -41,7 +45,7 @@ else ${ARCHIVE}: endif - @ if ${TEST} ! -f "${ARCHIVE}" || ${TEST} -n "`${FIND} . \( ${FINDSTRING} \) -newer "${ARCHIVE}"`"; then \ + @ if ${TEST} ! -f "${ARCHIVE}" || ${TEST} -n "`${FIND} . -newer ${ARCHIVE} \( ${FINDSTRING} \)`"; then \ ${RM} -f ${ARCHIVE}; \ ${ECHO} "Creating ${ARCHIVE}..."; \ ${JAR} -cf ${ARCHIVE} `${FIND} . \( ${FINDSTRING} \) -print|${SED} -e "s@^./@@"`; \ |
From: CVS B. <vt...@fr...> - 2000-10-25 04:00:07
|
User: vt Date: 00/10/24 20:59:59 Modified: src/java/gnu/j4/examples ServerSocketTest.java Log: Documentation update Revision Changes Path 1.4 +10 -0 J4/src/java/gnu/j4/examples/ServerSocketTest.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/ServerSocketTest.java?annotate=1.4&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/ServerSocketTest.java?rev=1.4&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/ServerSocketTest.java.diff?r1=1.4&r2=1.3&cvsroot=jukebox4 ----------------------------------- Index: ServerSocketTest.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/examples/ServerSocketTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ServerSocketTest.java 2000/10/25 02:59:34 1.3 +++ ServerSocketTest.java 2000/10/25 03:59:59 1.4 @@ -5,6 +5,16 @@ import gnu.j4.service.ServiceUnavailableException; import gnu.j4.framework.server.net.SocketAcceptor; +/** + * A unit test for the bug related to <code>ServerSocket.accept()</code> + * call on Linux. + * + * Fortunately, seems to have disappeared in either JDK 1.2 or JDK 1.3, so + * this test is going to pass, unless you have a really old or weird JVM. + * + * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1998 + * @version $Id: ServerSocketTest.java,v 1.4 2000/10/25 03:59:59 vt Exp $ + */ public class ServerSocketTest extends ActiveService { public static final String LOG_SST = "ServerSocketBug"; |
From: CVS B. <vt...@fr...> - 2000-10-25 03:44:20
|
User: vt Date: 00/10/24 20:44:22 Modified: src/java/gnu/j4/framework/server TransactionAdapterImpl.java Log: Adjusted the behavior to eliminate the unnecessary complaint Revision Changes Path 1.6 +11 -2 J4/src/java/gnu/j4/framework/server/TransactionAdapterImpl.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/framework/server/TransactionAdapterImpl.java?annotate=1.6&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/framework/server/TransactionAdapterImpl.java?rev=1.6&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/framework/server/TransactionAdapterImpl.java.diff?r1=1.6&r2=1.5&cvsroot=jukebox4 ----------------------------------- Index: TransactionAdapterImpl.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/framework/server/TransactionAdapterImpl.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TransactionAdapterImpl.java 2000/03/03 04:20:17 1.5 +++ TransactionAdapterImpl.java 2000/10/25 03:44:22 1.6 @@ -11,6 +11,7 @@ import gnu.j4.service.Service; import gnu.j4.service.ServiceUnavailableException; import gnu.j4.service.ActiveService; +import gnu.j4.service.PassiveService; import gnu.j4.io.LimitedInputStream; import gnu.j4.framework.comm.*; import gnu.j4.framework.UnsupportedRequestException; @@ -53,7 +54,7 @@ * never get a chance to initialize the object stream. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1998 - * @version $Id: TransactionAdapterImpl.java,v 1.5 2000/03/03 04:20:17 vt Exp $ + * @version $Id: TransactionAdapterImpl.java,v 1.6 2000/10/25 03:44:22 vt Exp $ */ public class TransactionAdapterImpl extends ActiveService implements TransactionAdapter, LogFacility { @@ -316,7 +317,15 @@ */ protected void shutdown() throws InterruptedException { - if ( conn instanceof Service ) { + if ( conn instanceof PassiveService ) { + + if ( ((PassiveService)conn).isEnabled() ) { + + ((PassiveService)conn).stop(); + } + + } else if ( conn instanceof Service ) { + ((Service)conn).stop(); } |
From: CVS B. <vt...@fr...> - 2000-10-25 03:12:08
|
User: vt Date: 00/10/24 20:12:06 Modified: src/java/gnu/j4/framework/server/net SocketAcceptor.java Log: Minor complaint Revision Changes Path 1.9 +3 -1 J4/src/java/gnu/j4/framework/server/net/SocketAcceptor.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/framework/server/net/SocketAcceptor.java?annotate=1.9&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/framework/server/net/SocketAcceptor.java?rev=1.9&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/framework/server/net/SocketAcceptor.java.diff?r1=1.9&r2=1.8&cvsroot=jukebox4 ----------------------------------- Index: SocketAcceptor.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/framework/server/net/SocketAcceptor.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- SocketAcceptor.java 2000/03/03 04:20:17 1.8 +++ SocketAcceptor.java 2000/10/25 03:12:06 1.9 @@ -62,7 +62,7 @@ * @see gnu.j4.framework.server.Acceptor * @see SocketStreamAdapter * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1998 - * @version $Id: SocketAcceptor.java,v 1.8 2000/03/03 04:20:17 vt Exp $ + * @version $Id: SocketAcceptor.java,v 1.9 2000/10/25 03:12:06 vt Exp $ */ public class SocketAcceptor extends ActiveService implements Acceptor, LogFacility { /** @@ -340,6 +340,8 @@ * another thread. */ public void shutdown() throws InterruptedException { + + complain(LOG_DEBUG, LOG_PKG, "Shut down."); } /** |
From: CVS B. <vt...@fr...> - 2000-10-25 02:59:33
|
User: vt Date: 00/10/24 19:59:35 Modified: src/java/gnu/j4/examples ServerSocketTest.java Log: Made the test a little more readable. Probably, it's obsolete by now anyway, but it's good to keep the things neat. Revision Changes Path 1.3 +18 -1 J4/src/java/gnu/j4/examples/ServerSocketTest.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/ServerSocketTest.java?annotate=1.3&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/ServerSocketTest.java?rev=1.3&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/ServerSocketTest.java.diff?r1=1.3&r2=1.2&cvsroot=jukebox4 ----------------------------------- Index: ServerSocketTest.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/examples/ServerSocketTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ServerSocketTest.java 2000/03/03 04:20:16 1.2 +++ ServerSocketTest.java 2000/10/25 02:59:34 1.3 @@ -1,5 +1,6 @@ package gnu.j4.examples; +import gnu.j4.sem.SemaphoreTimedOutException; import gnu.j4.service.ActiveService; import gnu.j4.service.ServiceUnavailableException; import gnu.j4.framework.server.net.SocketAcceptor; @@ -29,7 +30,23 @@ complain(LOG_NOTICE, LOG_SST, "Sleeping for 10 seconds..."); Thread.sleep(10000); complain(LOG_NOTICE, LOG_SST, "Trying to interrupt the acceptor..."); - acceptor.stop(); + + try { + + if ( !acceptor.stop().waitFor(2000) ) { + + complain(LOG_WARNING, LOG_SST, "Oh well. Can't stop it, it is not safe to use the socket connector on this platform."); + + } else { + + complain(LOG_NOTICE, LOG_SST, "Passed."); + removeDependant(acceptor); + } + + } catch ( SemaphoreTimedOutException stex ) { + + complain(LOG_WARNING, LOG_SST, "Timed out waiting 2 seconds for the acceptor to stop: " + stex.getMessage()); + } } protected void shutdown() throws InterruptedException { |
From: CVS B. <vt...@fr...> - 2000-10-20 05:59:38
|
User: vt Date: 00/10/19 22:59:43 J4/src/scripts/test - New directory |
From: CVS B. <vt...@fr...> - 2000-10-20 05:59:38
|
User: vt Date: 00/10/19 22:59:42 J4/src/scripts/run - New directory |
From: CVS B. <vt...@fr...> - 2000-10-20 03:59:30
|
User: vt Date: 00/10/19 20:59:36 J4/src/java/gnu/j4/test/unit - New directory |
From: CVS B. <vt...@fr...> - 2000-10-20 03:59:30
|
User: vt Date: 00/10/19 20:59:36 J4/src/java/gnu/j4/test/integration - New directory |
From: CVS B. <vt...@fr...> - 2000-10-20 03:59:14
|
User: vt Date: 00/10/19 20:59:16 J4/src/java/gnu/j4/test - New directory |