/** * Provides a means for an NGSession to register the starting of a nail * execution with the server. * * @param nailClass the nail class that was launched */ void nailStarted(Class nailClass) { NailStats stats = getOrCreateStatsFor(nailClass); stats.nailStarted(); }
public static void nailMain(NGContext context) { context.getNGServer().shutdown(true); }
/** * @see java.io.PrintStream#close() */ public void close() { getPrintStream().close(); }
/** * Returns an NGSession from the pool, or creates one if necessary * @return an NGSession ready to work */ NGSession take() { NGSession result; synchronized(lock) { if (poolEntries == 0) { result = new NGSession(this, server); result.start(); } else { --poolEntries; result = pool[poolEntries]; } } return (result); }
/** * Creates a new NGServer that will listen on the default port (defined in * <code>NGConstants.DEFAULT_PORT</code>). This does <b>not</b> cause the * server to start listening. To do so, create a new * <code>Thread</code> wrapping this * <code>NGServer</code> and start it. */ public NGServer() { init(null, NGConstants.DEFAULT_PORT, DEFAULT_SESSIONPOOLSIZE); }
/** * @see java.io.OutputStream.write(int) */ public void write(int b) throws IOException { byte[] b2 = {(byte) b}; write(b2, 0, 1); }
/** * @see java.io.InputStream#read() */ public int read() throws IOException { if (oneByteBuffer == null) oneByteBuffer = new byte[1]; return((read(oneByteBuffer, 0, 1) == -1) ? -1 : (int) oneByteBuffer[0]); }
/** * Checks whether two Aliases have the same name. Does <b>not</b> * compare any other fields. * @param o the other Alias to check * @return true if the specified Alias has the same name as this Alias. */ public boolean equals(Object o) { return (compareTo(o) == 0); }
/** * Updates the current thread name (useful for debugging). */ private void updateThreadName(String detail) { setName("NGSession " + instanceNumber + ": " + ((detail == null) ? "(idle)" : detail)); } }
/** * @see java.io.InputStream#read(byte[],int,int) */ public int read(byte[] b, int off, int len) throws IOException { return (getInputStream().read(b, off, len)); }
/** * Provides a means for an NGSession to register the completion of a nails * execution with the server. * * @param nailClass the nail class that finished */ void nailFinished(Class nailClass) { NailStats stats = (NailStats) allNailStats.get(nailClass); stats.nailFinished(); }
/** * @see java.io.PrintStream#print(double) */ public void print(double d) { getPrintStream().print(d); }
/** * Creates a new NGServer that will listen at the specified address and on * the specified port with the specified session pool size. This does * <b>not</b> cause the server to start listening. To do so, create a new * <code>Thread</code> wrapping this * <code>NGServer</code> and start it. * * @param addr the address at which to listen, or * <code>null</code> to bind to all local addresses * @param port the port on which to listen. * @param sessionPoolSize the max number of idle sessions allowed by the * pool */ public NGServer(InetAddress addr, int port, int sessionPoolSize) { init(addr, port, sessionPoolSize); }
/** * @see java.io.OutputStream.write(byte[]) */ public void write(byte[] b) throws IOException { write(b, 0, b.length); }
/** * @see java.io.InputStream.read(byte[]) */ public int read(byte[] b) throws IOException { return (read(b, 0, b.length)); }
/** * @see java.io.PrintStream#print(long) */ public void print(long l) { getPrintStream().print(l); }
/** * Creates a new NGServer that will listen at the specified address and on * the specified port with the default session pool size. This does * <b>not</b> cause the server to start listening. To do so, create a new * <code>Thread</code> wrapping this * <code>NGServer</code> and start it. * * @param addr the address at which to listen, or * <code>null</code> to bind to all local addresses * @param port the port on which to listen. * @param sessionPoolSize the max number of idle sessions allowed by the * pool */ public NGServer(InetAddress addr, int port) { init(addr, port, DEFAULT_SESSIONPOOLSIZE); }
/** * @see java.io.PrintStream#println() */ public void println() { getPrintStream().println(); }
/** * @see java.io.PrintStream#println(float) */ public void println(float x) { getPrintStream().println(x); }