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

How to use
ObjectPipe
in
com.ociweb.pronghorn.pipe

Best Java code snippets using com.ociweb.pronghorn.pipe.ObjectPipe (Showing top 20 results out of 315)

origin: oci-pronghorn/GreenLightning

public ProcessQuery(int pipelineBits, HTTPResponseService service, PoolManager pm) {
  
  
  this.DBRestInFlight = new ObjectPipe<ResultObject>(pipelineBits, ResultObject.class,	ResultObject::new);
  this.service = service;
  this.pm = pm;
  
  
}

origin: com.ociweb/pronghorn-pipes

public T headObject() {
  assert(isHeadThread());
  if (count()<mask) {
    return objects[head.get()&mask];
  } else {
    return null;
  }
}
origin: com.ociweb/pronghorn-pipes

public T tailObject() {
  assert(isTailThread());
  if (count()>0) {
    return objects[tail.get()&mask];
  } else {
    return null;
  }
}
origin: oci-pronghorn/GreenLightning

long seqCode = request.getSequenceCode();
if (DBUpdateInFlight.hasRoomFor(queries)) {		
        final ResultObject worldObject = DBUpdateInFlight.headObject();
        assert(null!=worldObject);
        DBUpdateInFlight.moveHeadForward(); //always move to ensure this can be read.
origin: oci-pronghorn/GreenLightning

public boolean restFortuneRequest(HTTPRequestReader request) {
  final FortunesObject target = fortuneInFlight.headObject(); 
  if (null!=target) {
    target.setConnectionId(request.getConnectionId());
    fortuneInFlight.moveHeadForward(); //always move to ensure this can be read.  //TODO: remove and combined with above
    return true;
  } else {
origin: oci-pronghorn/GreenLightning

private boolean consumeResultObjectDBRest(final ResultObject t) {
  boolean ok;
          
  ///////////////////////////////
  if (0 == t.getGroupSize()) {	
    ok = service.publishHTTPResponse(t.getConnectionId(), t.getSequenceId(), 200,
        HTTPContentTypeDefaults.JSON,
        w-> {
          Templates.singleTemplateDBRest.render(w, t);
          t.setStatus(-1);
          DBRestInFlight.moveTailForward();//only move forward when it is consumed.
          DBRestInFlight.publishTailPosition();
        });                    
  } else {
    //collect all the objects
    assert(isValidToAdd(t, collectorDBRest));
    collectorDBRest.add(t);                    
    DBRestInFlight.moveTailForward();
    if (collectorDBRest.size() == t.getGroupSize()) {
      //now ready to send, we have all the data						
      ok =publishMultiDBResponse(t.getConnectionId(), t.getSequenceId());
      
    } else {
      ok = true;//added to list
    }    
    //moved forward so we can read next but write logic will still be blocked by state not -1			 
    
  }
  return ok;
}
origin: oci-pronghorn/GreenLightning

public void tickEvent() { 
  {
    ResultObject temp = DBUpdateInFlight.tailObject();
    while (isReadyDBUpdate(temp)) {			
      if (consumeResultObjectDBUpdate(temp)) {
        temp = DBUpdateInFlight.tailObject();
      } else {
        break;
      }
    }       
  }
    
}

origin: oci-pronghorn/Pronghorn

public void moveTailForward() {
  assert(isTailThread());
  tail.incrementAndGet();        
}

origin: com.ociweb/pronghorn-pipes

public boolean hasRoomFor(int count) {
  return (this.count()+count)<=mask;
}

origin: oci-pronghorn/GreenLightning

private boolean publishMultiResponseDBUpdate(long conId, long seqCode) {
  boolean result =  service.publishHTTPResponse(conId, seqCode, 200,
                    HTTPContentTypeDefaults.JSON,
                    w-> {
                      Templates.multiTemplate.render(w, collectorDBUpdate);
                      int c = collectorDBUpdate.size();
                      while (--c>=0) {
                        assert(collectorDBUpdate.get(c).getConnectionId() == conId);
                        assert(collectorDBUpdate.get(c).getSequenceId() == seqCode);					    						   
                        collectorDBUpdate.get(c).setStatus(-1);
                      }
                      collectorDBUpdate.clear();
                      DBUpdateInFlight.publishTailPosition();
                    });
  collectionPendingDBUpdate = !result;
  return result;
}

origin: oci-pronghorn/GreenLightning

private boolean consumeResultObjectDBUpdate(final ResultObject t) {
  boolean ok;
  //collect all the objects
  collectorDBUpdate.add(t);
  DBUpdateInFlight.moveTailForward();//only move forward when it is consumed.
  if (collectorDBUpdate.size() == t.getGroupSize()) {
    //now ready to send, we have all the data						
    ok =publishMultiResponseDBUpdate(t.getConnectionId(), t.getSequenceId());
  } else {
    ok = true;//added to list
  }                
  
  return ok;
}
origin: oci-pronghorn/GreenLightning

public boolean multiRestRequest(HTTPRequestReader request) { 
  final int queries;
  if (Struct.DB_MULTI_ROUTE_INT == request.getRouteAssoc() ) {		
    queries = Math.min(Math.max(1, (request.structured().readInt(Field.QUERIES))),500);		
  } else {
    queries = 1;
  }
  

  if (DBRestInFlight.hasRoomFor(queries)) {
    
    sendQueries(pm.pool(),queries,request.getConnectionId(),request.getSequenceCode());
                
    return true;
  } else {
    return false;
  }    
}
origin: oci-pronghorn/GreenLightning

final ResultObject target = DBRestInFlight.headObject();
DBRestInFlight.moveHeadForward(); //always move to ensure this can be read.
origin: oci-pronghorn/GreenLightning

fortuneInFlight.moveTailForward();//only move forward when it is consumed.
fortuneInFlight.publishTailPosition();
t.list().clear();
htmlFortuneBuffer.clear();
origin: oci-pronghorn/GreenLightning

public void tickEvent() { 
  //for DBRest
  {
    ResultObject temp = DBRestInFlight.tailObject();
    while (isReadyDBRest(temp)) {			
      if (consumeResultObjectDBRest(temp)) {
        temp = DBRestInFlight.tailObject();
      } else {
        break;
      }
    }
  }
  
  
}

origin: com.ociweb/pronghorn-pipes

public void moveTailForward() {
  assert(isTailThread());
  tail.incrementAndGet();        
}

origin: oci-pronghorn/Pronghorn

public boolean hasRoomFor(int count) {
  return (this.count()+count)<=mask;
}

origin: oci-pronghorn/GreenLightning

private boolean publishMultiDBResponse(long conId, long seqCode) {
  final boolean result =  service.publishHTTPResponse(conId, seqCode, 200,
                    HTTPContentTypeDefaults.JSON,
                    w-> {
                      Templates.multiTemplateDBRest.render(w, collectorDBRest);
                                            int c = collectorDBRest.size();
                      assert(collectorDBRest.get(0).getGroupSize()==c);
                      while (--c >= 0) {
                        assert(collectorDBRest.get(0).getGroupSize()==collectorDBRest.size());
                        assert(collectorDBRest.get(c).getConnectionId() == conId) : c+" expected conId "+conId+" error: "+showCollection(collectorDBRest);
                        assert(collectorDBRest.get(c).getSequenceId() == seqCode) : c+" sequence error: "+showCollection(collectorDBRest);    						   
                        collectorDBRest.get(c).setStatus(-1);
                                             }
                      collectorDBRest.clear();                                               
                      DBRestInFlight.publishTailPosition();
                    });
  collectionPendingDBRest = !result;
  return result;
}
origin: oci-pronghorn/Pronghorn

public void moveHeadForward() {
  assert(isHeadThread());
  assert(count()<mask);
  head.incrementAndGet();        
}

origin: oci-pronghorn/GreenLightning

public boolean singleRestRequest(HTTPRequestReader request) { 
  final ResultObject target = DBRestInFlight.headObject();
  if (null!=target && -1==target.getStatus()) {
    target.setConnectionId(request.getConnectionId());
    DBRestInFlight.moveHeadForward(); //always move to ensure this can be read.
    return true;
  } else {
com.ociweb.pronghorn.pipeObjectPipe

Most used methods

  • <init>
  • count
  • hasRoomFor
  • headObject
  • isHeadThread
  • isTailThread
  • moveHeadForward
  • moveTailForward
  • publishTailPosition
  • tailObject

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onRequestPermissionsResult (Fragment)
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • JPanel (javax.swing)
  • JTextField (javax.swing)
  • 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