Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*    */ package org.jboss.net.sockets;
 /*    */ 
 /*    */ import java.io.Externalizable;
 /*    */ import java.io.IOException;
 /*    */ import java.io.ObjectInput;
 /*    */ import java.io.ObjectOutput;
 /*    */ import java.net.Socket;
 /*    */ import java.util.concurrent.Semaphore;
/*    */ 
/*    */ public class QueuedClientSocketFactory
/*    */   implements RMIClientSocketFactoryExternalizable
/*    */ {
/*    */   private transient Semaphore permits;
/*    */   private long numPermits;
/*    */ 
/*    */   public QueuedClientSocketFactory()
/*    */   {
/*    */   }
/*    */ 
/*    */   public QueuedClientSocketFactory(long nPermits)
/*    */   {
/* 45 */     this. = new Semaphore((int)nPermitstrue);
/* 46 */     this. = nPermits;
/*    */   }
/*    */ 
/*    */   public Socket createSocket(String hostint port)
/*    */     throws IOException
/*    */   {
/*    */     try
/*    */     {
/* 61 */       this..acquire();
/* 62 */       Socket localSocket = new Socket(hostport);
/*    */       return localSocket;
/*    */     }
/*    */     catch (InterruptedException ex)
/*    */     {
/* 66 */       throw new IOException("Failed to acquire FIFOSemaphore for ClientSocketFactory");
/*    */     }
/*    */     finally
/*    */     {
/* 70 */       this..release(); } throw localObject;
/*    */   }
/*    */ 
/*    */   public boolean equals(Object obj)
/*    */   {
/* 76 */     return obj instanceof QueuedClientSocketFactory;
/*    */   }
/*    */ 
/*    */   public int hashCode() {
/* 80 */     return getClass().getName().hashCode();
/*    */   }
/*    */ 
/*    */   public void writeExternal(ObjectOutput out)
/*    */     throws IOException
/*    */   {
/* 86 */     out.writeLong(this.);
/*    */   }
/*    */ 
/*    */   public void readExternal(ObjectInput inthrows IOExceptionClassNotFoundException
/*    */   {
/* 91 */     this. = in.readLong();
/* 92 */     this. = new Semaphore((int)this.true);
/*    */   }
/*    */ }
/* Location:           /home/mnovotny/projects/EMBEDDED_JBOSS_BETA3_COMMUNITY/embedded/output/lib/embedded-jboss/lib/jboss-embedded-all.jar
 * Qualified Name:     org.jboss.net.sockets.QueuedClientSocketFactory
 * JD-Core Version:    0.6.0
 */
New to GrepCode? Check out our FAQ X