Tabnine Logo
ClientSocketWriterStage
Code IndexAdd Tabnine to your IDE (free)

How to use
ClientSocketWriterStage
in
com.ociweb.pronghorn.network

Best Java code snippets using com.ociweb.pronghorn.network.ClientSocketWriterStage (Showing top 13 results out of 315)

origin: oci-pronghorn/Pronghorn

public static ClientSocketWriterStage newInstance(GraphManager graphManager, ClientCoordinator ccm, Pipe<NetPayloadSchema>[] input) {
  return new ClientSocketWriterStage(graphManager, ccm, input);
}
origin: oci-pronghorn/Pronghorn

  @Override
  public void run() {
      
    boolean doingWork;
    boolean didWork = false;
      doingWork = false;	
      
      int i = input.length;
      while (--i >= 0) {

        if (connections[i]==null) {
          Pipe<NetPayloadSchema> pipe = input[i];
          while (connections[i]==null && Pipe.hasContentToRead(pipe)) {	
            doingWork |= writeAll(doingWork, i, pipe, Pipe.peekInt(pipe));						
          }
        } else {
          //we have multiple connections so one blocking does not impact others.
          doingWork |= tryWrite(i);					
        }
      }
      didWork |= doingWork;

    
//        //we have no pipes to monitor so this must be done explicitly
    if (didWork && (null != this.didWorkMonitor)) {
      this.didWorkMonitor.published();
    }

  }

origin: oci-pronghorn/Pronghorn

private boolean writeAll(boolean didWork, int i, Pipe<NetPayloadSchema> pipe, int msgIdx) {
  
  //For the close test we must be sending a plain then a disconnect NOT two plains!!
  //Any sequential Plain or Encrypted values will be rolled together at times on the same connection.
  
  if (NetPayloadSchema.MSG_PLAIN_210 == msgIdx) {							
    didWork = writePlain(didWork, i, pipe);
  } else {
    didWork = writeAllLessCommon(didWork, i, pipe, msgIdx);
  }
  return didWork;
}
origin: oci-pronghorn/Pronghorn

private boolean writeAllLessCommon(boolean didWork, int i, Pipe<NetPayloadSchema> pipe, int msgIdx) {
  if (NetPayloadSchema.MSG_ENCRYPTED_200 == msgIdx) {											
    didWork = writeEncrypted(didWork, i, pipe);
  } else if (NetPayloadSchema.MSG_UPGRADE_307 == msgIdx) {							
    throw new UnsupportedOperationException("Connection upgrade is not yet supported.");
  } else if (NetPayloadSchema.MSG_BEGIN_208 == msgIdx) {							
    writeBegin(pipe);														
  } else if (NetPayloadSchema.MSG_DISCONNECT_203 == msgIdx) {							
    didWork = writeDisconnect(pipe);							
  } else {
    didWork = writeShutdown(didWork, pipe);		
  }
  return didWork;
}
origin: oci-pronghorn/Pronghorn

cc = checkBuffers(i, pipe, cc);
connections[i] = cc;
didWork |= tryWrite(i);
return didWork;
origin: oci-pronghorn/Pronghorn

ClientSocketWriterStage.newInstance(gm, clientCoordinator, input);
new SocketTestGenStage(gm, input, testUsers, testSeeds, testSizes, clientCoordinator, port);
origin: oci-pronghorn/Pronghorn

private boolean writeShutdown(boolean didWork, Pipe<NetPayloadSchema> pipe) {
  int msgIdx = Pipe.takeMsgIdx(pipe);
  if (msgIdx==-1) {
    Pipe.confirmLowLevelRead(pipe, Pipe.EOF_SIZE);                                
  } else {
    logger.info("unknown message idx received: {}",msgIdx);
  }
  Pipe.releaseReadLock(pipe);
  assert(-1 == msgIdx) : "Expected end of stream shutdown got "+msgIdx;
                
  if (--this.shutCountDown <= 0) {
    requestShutdown();
    didWork = false; //set to false so we exit.
  }
  return didWork;
}
origin: oci-pronghorn/Pronghorn

private boolean writeEncrypted(boolean didWork, int i, Pipe<NetPayloadSchema> pipe) {
  long chnl = Pipe.peekLong(pipe, 0xF&NetPayloadSchema.MSG_ENCRYPTED_200_FIELD_CONNECTIONID_201);
  ClientConnection cc = (ClientConnection)ccm.lookupConnectionById(chnl);
    
  if (null==cc) {//closed or we can not get it yet, just push back till later.
    return false;
  }
  final int msgIdx = Pipe.takeMsgIdx(pipe);
  final long channelId = Pipe.takeLong(pipe);
  assert(chnl==channelId);
  final long arrivalTime = Pipe.takeLong(pipe);
  int meta = Pipe.takeByteArrayMetaData(pipe); //for string and byte array
  int len = Pipe.takeByteArrayLength(pipe);							
  
  if (showWrites) {
    logger.info("/////\n/// has connection "+((cc!=null)&&cc.isValid())+" channelId "+channelId+" write encrypted length:"+len);
    
  }
  
  didWork = wrapupUpEncryptedToSingleWrite(didWork, i, 
                      pipe, msgIdx, channelId, meta, len,
                      cc);

  return didWork;
}
origin: oci-pronghorn/Pronghorn

didWork = rollUpPlainsToSingleWrite(didWork, i, 
    pipe, msgIdx, channelId, cc, meta,
    len);
origin: oci-pronghorn/Pronghorn

checkBuffers(i, pipe, cc);
didWork |= tryWrite(i);
return didWork;
origin: oci-pronghorn/Pronghorn

ClientSocketWriterStage.newInstance(gm, clientCoordinator, input);
new SocketTestGenStage(gm, input, testUsers, testSeeds, testSizes, clientCoordinator, port);
origin: oci-pronghorn/Pronghorn

public static void buildSimpleTLSClient(GraphManager graphManager, ClientCoordinator clientCoordinator,
    Pipe<NetPayloadSchema>[] clientPlainOutput, Pipe<NetPayloadSchema>[] clientPlainInput) {
  
  Pipe<ReleaseSchema>[]    clientReleaseAck =new Pipe[] {ReleaseSchema.instance.newPipe(1024, 0)};
  Pipe<NetPayloadSchema>[] clientHandshakePipe = new Pipe[] {NetPayloadSchema.instance.newPipe(8, 1<<16)}; 
  Pipe<NetPayloadSchema>[] clientEncyptedInput = Pipe.buildPipes(clientPlainInput);
  Pipe<NetPayloadSchema>[] clientEncryptedOutput = Pipe.buildPipes(clientPlainOutput);
  
  ClientSocketReaderStage reader = new ClientSocketReaderStage(graphManager, clientCoordinator, clientReleaseAck, clientEncyptedInput );
  GraphManager.addNota(graphManager, GraphManager.DOT_RANK_NAME, "SocketReader", reader);
  
  SSLEngineUnWrapStage unwrap = new SSLEngineUnWrapStage(graphManager, clientCoordinator, clientEncyptedInput, clientPlainInput, clientReleaseAck[0], clientHandshakePipe[0], false /*isServer*/);
  GraphManager.addNota(graphManager, GraphManager.DOT_RANK_NAME, "UnWrap", unwrap);
  
  new SSLEngineWrapStage(graphManager, clientCoordinator, false /*isServer*/, clientPlainOutput, clientEncryptedOutput);		
  new ClientSocketWriterStage(graphManager, clientCoordinator, PronghornStage.join(clientEncryptedOutput, clientHandshakePipe));
}
origin: oci-pronghorn/Pronghorn

ClientSocketWriterStage socketWriteStage = new ClientSocketWriterStage(gm, ccm, clientRequests[i]);
GraphManager.addNota(gm, GraphManager.DOT_RANK_NAME, "SocketWriter", socketWriteStage);
ccm.processNota(gm, socketWriteStage);
com.ociweb.pronghorn.networkClientSocketWriterStage

Javadoc

Write to a socket using a client coordinator.

Most used methods

  • <init>
  • checkBuffers
  • newInstance
  • requestShutdown
  • rollUpPlainsToSingleWrite
  • tryWrite
  • wrapupUpEncryptedToSingleWrite
  • writeAll
  • writeAllLessCommon
  • writeBegin
  • writeDisconnect
  • writeEncrypted
  • writeDisconnect,
  • writeEncrypted,
  • writePlain,
  • writeShutdown

Popular in Java

  • Making http requests using okhttp
  • findViewById (Activity)
  • onRequestPermissionsResult (Fragment)
  • compareTo (BigDecimal)
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • JPanel (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now