idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
136,600
private boolean checkID ( long id ) { if ( lastReceived == 0 || id == lastReceived + 1 || id < lastReceived ) { lastReceived = id ; if ( lastReceived % BATCH_SIZE == 0 ) { ack ( ) ; } return true ; } else { fail ( ) ; } return false ; }
Checks that the given ID is valid .
136,601
private void ack ( ) { if ( open && connected ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "%s - Acking messages up to: %d" , this , lastReceived ) ) ; } eventBus . send ( outAddress , new JsonObject ( ) . putString ( "action" , "ack" ) . putNumber ( "id" , lastReceived ) ) ; lastFeedbackTime =...
Sends an ack message for the current received count .
136,602
@ SuppressWarnings ( "unchecked" ) private void doMessage ( final JsonObject message ) { Object value = deserializer . deserialize ( message ) ; if ( value != null && messageHandler != null ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "%s - Received: Message[id=%d, value=%s]" , this , message ....
Handles receiving a message .
136,603
void groupReady ( String group ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "%s - Group ready: Group[group=%s]" , this , group ) ) ; } eventBus . send ( outAddress , new JsonObject ( ) . putString ( "action" , "group" ) . putString ( "group" , group ) ) ; }
Indicates that an input group is ready .
136,604
private void doGroupMessage ( final JsonObject message ) { String groupID = message . getString ( "group" ) ; DefaultConnectionInputGroup group = groups . get ( groupID ) ; if ( group != null ) { Object value = deserializer . deserialize ( message ) ; if ( value != null ) { if ( log . isDebugEnabled ( ) ) { log . debug...
Handles a group message .
136,605
private void doGroupEnd ( final JsonObject message ) { String groupID = message . getString ( "group" ) ; DefaultConnectionInputGroup group = groups . remove ( groupID ) ; if ( group != null ) { Object args = deserializer . deserialize ( message ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "%s ...
Handles a group end .
136,606
void batchReady ( String batch ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "%s - Batch ready: Batch[batch=%s]" , this , batch ) ) ; } eventBus . send ( outAddress , new JsonObject ( ) . putString ( "action" , "batch" ) . putString ( "batch" , batch ) ) ; }
Indicates that an input batch is ready .
136,607
private void doBatchMessage ( final JsonObject message ) { String batchID = message . getString ( "batch" ) ; if ( currentBatch != null && currentBatch . id ( ) . equals ( batchID ) ) { Object value = deserializer . deserialize ( message ) ; if ( value != null ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String ...
Handles a batch message .
136,608
private void doBatchEnd ( final JsonObject message ) { if ( currentBatch != null ) { Object args = deserializer . deserialize ( message ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "%s - Batch ended: Batch[batch=%s, args=%s]" , this , currentBatch . id ( ) , args ) ) ; } currentBatch . handleEn...
Handles a batch end .
136,609
private void doConnect ( final Message < JsonObject > message ) { if ( open ) { if ( ! connected ) { groups . clear ( ) ; connected = true ; } message . reply ( true ) ; log . debug ( String . format ( "%s - Accepted connect request from %s" , this , context . source ( ) ) ) ; } else { message . reply ( false ) ; log ....
Handles connect .
136,610
synchronized static PersistentPropertyStorage newPersistentPropertyStorage ( String propertyFile ) throws IOException { File file = new File ( propertyFile ) ; String canonicalName = file . getCanonicalPath ( ) ; if ( propertyFileMap . containsKey ( canonicalName ) ) { return ( PersistentPropertyStorage ) propertyFileM...
Factory method for PersistentPropertyStorage . Guarantees that only a single PersistentPropertyStorage object exists for any property file .
136,611
public void locateCluster ( String cluster , Handler < AsyncResult < String > > doneHandler ) { Set < String > registry = vertx . sharedData ( ) . getSet ( cluster ) ; synchronized ( registry ) { if ( ! registry . isEmpty ( ) ) { locateNode ( cluster , new HashSet < > ( registry ) , doneHandler ) ; } } }
Locates the local address of the nearest node if one exists .
136,612
private void locateNode ( String address , Set < String > nodes , Handler < AsyncResult < String > > doneHandler ) { locateNode ( address , nodes . iterator ( ) , doneHandler ) ; }
Locates an active local node in a set of nodes .
136,613
private void locateNode ( final String address , final Iterator < String > nodes , final Handler < AsyncResult < String > > doneHandler ) { if ( nodes . hasNext ( ) ) { final String node = nodes . next ( ) ; vertx . eventBus ( ) . sendWithTimeout ( node , new JsonObject ( ) . putString ( "action" , "ping" ) , 1000 , ne...
Locates an active local node in a list of nodes .
136,614
private void removeNode ( String address , String node ) { Set < String > registry = vertx . sharedData ( ) . getSet ( address ) ; registry . remove ( node ) ; }
Removes a node from the local registry .
136,615
@ SuppressWarnings ( "unchecked" ) public static < T extends ComponentConfig < T > > T createComponent ( JsonObject config ) { return ( T ) serializer . deserializeObject ( config , ComponentConfig . class ) ; }
Creates a component configuration from json .
136,616
public static NetworkConfig mergeNetworks ( NetworkConfig base , NetworkConfig merge ) { if ( ! base . getName ( ) . equals ( merge . getName ( ) ) ) { throw new IllegalArgumentException ( "Cannot merge networks of different names." ) ; } for ( ComponentConfig < ? > component : merge . getComponents ( ) ) { if ( ! base...
Merges two network configurations into a single configuraiton .
136,617
public static NetworkConfig unmergeNetworks ( NetworkConfig base , NetworkConfig unmerge ) { if ( ! base . getName ( ) . equals ( unmerge . getName ( ) ) ) { throw new IllegalArgumentException ( "Cannot merge networks of different names." ) ; } for ( ComponentConfig < ? > component : unmerge . getComponents ( ) ) { bas...
Unmerges one network configuration from another .
136,618
public < T > ContextManager execute ( Action < T > action , Handler < AsyncResult < T > > resultHandler ) { vertx . executeBlocking ( action , resultHandler ) ; return this ; }
Executes a blocking action on a background thread .
136,619
public final void onDismissed ( Snackbar snackbar , int dismissEvent ) { super . onDismissed ( snackbar , dismissEvent ) ; notifySnackbarCallback ( snackbar , dismissEvent ) ; }
Notifies that the Snackbar has been dismissed through some event for example swiping or the action being pressed .
136,620
private void closeFile ( final String filePath , AsyncFile file ) { file . close ( new Handler < AsyncResult < Void > > ( ) { public void handle ( AsyncResult < Void > result ) { if ( result . failed ( ) ) { try { input . vertx ( ) . fileSystem ( ) . deleteSync ( filePath ) ; } catch ( Exception e ) { } if ( exceptionH...
Closes a file .
136,621
private String getClusterMain ( ) { if ( clusterMain == null ) { try { clusterMain = System . getProperty ( CLUSTER_MAIN_PROPERTY_NAME ) ; } catch ( Exception e ) { } clusterMain = ClusterAgent . class . getName ( ) ; } return clusterMain ; }
Loads the current cluster verticle .
136,622
public Vertigo deployCluster ( Handler < AsyncResult < Cluster > > doneHandler ) { return deployCluster ( ContextUri . createUniqueScheme ( ) , doneHandler ) ; }
Deploys a randomly named unique cluster .
136,623
public Vertigo getCluster ( String address , Handler < AsyncResult < Cluster > > resultHandler ) { Cluster cluster = new DefaultCluster ( address , vertx , container ) ; cluster . ping ( resultHandler ) ; return this ; }
Loads a cluster .
136,624
protected void checkAddress ( ) { if ( localAddress == null ) { check ++ ; if ( check > 1000 && System . currentTimeMillis ( ) - lastReset > 15000 ) { resetLocalAddress ( null ) ; } } }
Checks whether the local cluster address needs to be updated .
136,625
protected void resetLocalAddress ( final Handler < AsyncResult < Boolean > > doneHandler ) { localAddress = null ; lastReset = System . currentTimeMillis ( ) ; clusterLocator . locateCluster ( address , new Handler < AsyncResult < String > > ( ) { public void handle ( AsyncResult < String > result ) { if ( result . suc...
Updates the known local group address .
136,626
public static JsonObject serialize ( Context < ? > context ) { if ( context instanceof NetworkContext ) { return serialize ( NetworkContext . class . cast ( context ) ) ; } else if ( context instanceof ComponentContext ) { return serialize ( ComponentContext . class . cast ( context ) ) ; } else if ( context instanceof...
Serializes a context to JSON .
136,627
public static JsonObject serialize ( InstanceContext context ) { return serialize ( context . uri ( ) , context . component ( ) . network ( ) ) ; }
Serializes an instance context to JSON .
136,628
public static JsonObject serialize ( InputPortContext context ) { return serialize ( context . uri ( ) , context . input ( ) . instance ( ) . component ( ) . network ( ) ) ; }
Serializes an input port context to JSON .
136,629
public static JsonObject serialize ( OutputPortContext context ) { return serialize ( context . uri ( ) , context . output ( ) . instance ( ) . component ( ) . network ( ) ) ; }
Serializes an output port context to JSON .
136,630
public static < T extends Context < T > > T deserialize ( JsonObject context ) { return deserialize ( context . getString ( "uri" ) , context . getObject ( "context" ) ) ; }
Deserializes a context from JSON .
136,631
public boolean get ( boolean defaultValue ) { final String value = getInternal ( Boolean . toString ( defaultValue ) , false ) ; if ( value == null ) { return defaultValue ; } return toBoolean ( value ) ; }
Retrieves the value of this boolean property .
136,632
public boolean set ( boolean value ) { String prevValue = setString ( Boolean . toString ( value ) ) ; if ( prevValue == null ) { prevValue = getDefaultValue ( ) ; if ( prevValue == null ) { return false ; } } return toBoolean ( prevValue ) ; }
Sets the value of this boolean property .
136,633
private JsonObject loadJson ( String fileName ) { URL url = cl . getResource ( fileName ) ; try { try ( Scanner scanner = new Scanner ( url . openStream ( ) , "UTF-8" ) . useDelimiter ( "\\A" ) ) { String json = scanner . next ( ) ; return new JsonObject ( json ) ; } catch ( NoSuchElementException e ) { throw new Vertx...
Loads a network definition from a json network file .
136,634
static HazelcastInstance getHazelcastInstance ( Vertx vertx ) { VertxInternal vertxInternal = ( VertxInternal ) vertx ; ClusterManager clusterManager = vertxInternal . clusterManager ( ) ; if ( clusterManager != null ) { Class < ? > clazz = clusterManager . getClass ( ) ; Field field ; try { field = clazz . getDeclared...
Returns the Vert . x Hazelcast instance if one exists .
136,635
public ClusterListener createClusterListener ( boolean localOnly ) { if ( localOnly ) return new NoClusterListener ( ) ; HazelcastInstance hazelcast = getHazelcastInstance ( vertx ) ; if ( hazelcast != null ) { return new HazelcastClusterListener ( hazelcast , vertx ) ; } else { return new NoClusterListener ( ) ; } }
Creates a cluster listener .
136,636
private void doFind ( final Message < JsonObject > message ) { String type = message . body ( ) . getString ( "type" ) ; if ( type != null ) { switch ( type ) { case "group" : doFindGroup ( message ) ; break ; case "node" : doFindNode ( message ) ; break ; case "network" : doFindNetwork ( message ) ; break ; default : ...
Finds a node in the cluster .
136,637
private void doFindGroup ( final Message < JsonObject > message ) { String group = message . body ( ) . getString ( "group" ) ; if ( group == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "Invalid group name." ) ) ; return ; } final String address = String . ...
Finds a group in the cluster .
136,638
private void doFindNetwork ( final Message < JsonObject > message ) { final String name = message . body ( ) . getString ( "network" ) ; if ( name == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No network name specified." ) ) ; } else { context . execute (...
Loads a network configuration .
136,639
private void doListGroup ( final Message < JsonObject > message ) { context . execute ( new Action < Set < String > > ( ) { public Set < String > perform ( ) { return groups . keySet ( ) ; } } , new Handler < AsyncResult < Set < String > > > ( ) { public void handle ( AsyncResult < Set < String > > result ) { if ( resu...
Lists groups in the cluster .
136,640
private void doListNode ( final Message < JsonObject > message ) { context . execute ( new Action < Collection < String > > ( ) { public Collection < String > perform ( ) { List < String > nodes = new ArrayList < > ( ) ; for ( String group : groups . keySet ( ) ) { nodes . addAll ( groups . get ( group ) ) ; } return n...
Lists nodes in the cluster .
136,641
private void doListNetwork ( final Message < JsonObject > message ) { context . execute ( new Action < List < NetworkContext > > ( ) { public List < NetworkContext > perform ( ) { List < NetworkContext > contexts = new ArrayList < > ( ) ; for ( String name : networks ) { String scontext = data . < String , String > get...
Lists the networks running in the cluster .
136,642
private void doSelect ( final Message < JsonObject > message ) { String type = message . body ( ) . getString ( "type" ) ; if ( type != null ) { switch ( type ) { case "group" : doSelectGroup ( message ) ; break ; case "node" : doSelectNode ( message ) ; break ; default : message . reply ( new JsonObject ( ) . putStrin...
Selects an object in the cluster .
136,643
private void selectNode ( final Object key , final Handler < AsyncResult < String > > doneHandler ) { context . execute ( new Action < String > ( ) { public String perform ( ) { String address = nodeSelectors . get ( key ) ; if ( address != null ) { return address ; } Set < String > nodes = new HashSet < > ( ) ; for ( ...
Selects a node .
136,644
private Handler < AsyncResult < String > > createDeploymentHandler ( final Message < JsonObject > message ) { return new Handler < AsyncResult < String > > ( ) { public void handle ( AsyncResult < String > result ) { if ( result . failed ( ) ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . ...
Creates a platform deployment handler .
136,645
private Handler < AsyncResult < String > > createRedeployHandler ( final JsonObject deploymentInfo , final CountDownLatch latch ) { return new Handler < AsyncResult < String > > ( ) { public void handle ( AsyncResult < String > result ) { if ( result . failed ( ) ) { log . error ( result . cause ( ) ) ; latch . countDo...
Creates a redeploy handler .
136,646
private void findDeploymentAddress ( final String deploymentID , Handler < AsyncResult < String > > resultHandler ) { context . execute ( new Action < String > ( ) { public String perform ( ) { synchronized ( deployments ) { JsonObject locatedInfo = null ; Collection < String > sdeploymentsInfo = deployments . get ( cl...
Locates the internal address of the node on which a deployment is deployed .
136,647
private Handler < AsyncResult < Void > > createUndeployHandler ( final Message < JsonObject > message ) { return new Handler < AsyncResult < Void > > ( ) { public void handle ( AsyncResult < Void > result ) { if ( result . failed ( ) ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putStrin...
Creates a platform undeploy handler .
136,648
private void removeDeployment ( final String deploymentID , Handler < AsyncResult < String > > doneHandler ) { context . execute ( new Action < String > ( ) { public String perform ( ) { Collection < String > clusterDeployments = deployments . get ( cluster ) ; if ( clusterDeployments != null ) { String deployment = nu...
Removes a deployment from the deployments map and returns the real deploymentID .
136,649
private void doUndeployNetwork ( final Message < JsonObject > message ) { Object network = message . body ( ) . getValue ( "network" ) ; if ( network != null ) { String key ; if ( network instanceof String ) { key = ( String ) network ; } else if ( network instanceof JsonObject ) { try { key = serializer . deserializeO...
Undeploys a network .
136,650
private void doKeySet ( final Message < JsonObject > message ) { final String key = message . body ( ) . getString ( "name" ) ; if ( key == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No key specified." ) ) ; return ; } final Object value = message . body ...
Handles setting a key .
136,651
private void doCounterGet ( final Message < JsonObject > message ) { final String name = message . body ( ) . getString ( "name" ) ; if ( name == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No name specified." ) ) ; return ; } context . execute ( new Actio...
Handles getting a counter .
136,652
private void doMultiMapRemove ( final Message < JsonObject > message ) { final String name = message . body ( ) . getString ( "name" ) ; if ( name == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No name specified." ) ) ; return ; } final Object key = messag...
Handles a cluster multi - map remove command .
136,653
private void doMultiMapKeys ( final Message < JsonObject > message ) { final String name = message . body ( ) . getString ( "name" ) ; if ( name == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No name specified." ) ) ; return ; } context . execute ( new Act...
Handles a cluster multi - map keys command .
136,654
private void doMapPut ( final Message < JsonObject > message ) { final String name = message . body ( ) . getString ( "name" ) ; if ( name == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No name specified." ) ) ; return ; } final Object key = message . body...
Handles a cluster map put command .
136,655
private void doListGet ( final Message < JsonObject > message ) { final String name = message . body ( ) . getString ( "name" ) ; if ( name == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No name specified." ) ) ; return ; } final Integer index = message . ...
Handles a list get .
136,656
private void doListRemove ( final Message < JsonObject > message ) { final String name = message . body ( ) . getString ( "name" ) ; if ( name == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No name specified." ) ) ; return ; } if ( message . body ( ) . con...
Handles a list removal .
136,657
private void doQueueIsEmpty ( final Message < JsonObject > message ) { final String name = message . body ( ) . getString ( "name" ) ; if ( name == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No name specified." ) ) ; return ; } context . execute ( new Act...
Handles cluster queue is empty command .
136,658
private void doQueueClear ( final Message < JsonObject > message ) { final String name = message . body ( ) . getString ( "name" ) ; if ( name == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No name specified." ) ) ; return ; } context . execute ( new Actio...
Clears all items in a queue .
136,659
private void doQueueOffer ( final Message < JsonObject > message ) { final String name = message . body ( ) . getString ( "name" ) ; if ( name == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No name specified." ) ) ; return ; } final Object value = message ...
Handles a queue offer command .
136,660
private void doQueueElement ( final Message < JsonObject > message ) { final String name = message . body ( ) . getString ( "name" ) ; if ( name == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No name specified." ) ) ; return ; } context . execute ( new Act...
Handles a queue element command .
136,661
public Integer getInstance ( ) { try { return Integer . valueOf ( uri . getPath ( ) . split ( "/" ) [ 2 ] ) ; } catch ( IndexOutOfBoundsException e ) { return null ; } }
Returns the instance number .
136,662
public String getEndpoint ( ) { try { String endpointString = uri . getPath ( ) . split ( "/" ) [ 3 ] ; if ( ! endpointString . equals ( ENDPOINT_IN ) && ! endpointString . equals ( ENDPOINT_OUT ) ) { throw new IllegalArgumentException ( endpointString + " is not a valid context endpoint" ) ; } return endpointString ; ...
Returns the context endpoint type .
136,663
public Map < String , String > getQuery ( ) { String query = uri . getQuery ( ) ; String [ ] pairs = query . split ( "&" ) ; Map < String , String > args = new HashMap < > ( ) ; for ( String pair : pairs ) { int idx = pair . indexOf ( "=" ) ; try { args . put ( URLDecoder . decode ( pair . substring ( 0 , idx ) , "UTF-...
Returns a map of all query arguments .
136,664
@ SuppressWarnings ( "unchecked" ) public < T > T getQuery ( String name ) { return ( T ) getQuery ( ) . get ( name ) ; }
Returns a specific query argument .
136,665
protected String getInternal ( String defaultValue , boolean required ) { String value = properties . getProperty ( path , defaultValue ) ; if ( value != null ) { return value ; } if ( defaultValue == null ) { value = getDefaultValue ( ) ; if ( value != null ) { return value ; } } if ( required ) { throw new RuntimeExc...
Retrieves the value of a property using a given default value and optionally failing if there is no value .
136,666
public void onChange ( String oldValue , String value ) { if ( TriggerableProperties . equals ( oldValue , value ) ) { return ; } triggerList . execute ( this , value ) ; }
Called when a property s value has just changed .
136,667
public boolean booleanValue ( ) { final String value = getInternal ( null , false ) ; if ( value == null ) { return false ; } return toBoolean ( value ) ; }
Returns the boolean value of this property .
136,668
public static boolean toBoolean ( final String value ) { String trimmedLowerValue = value . toLowerCase ( ) . trim ( ) ; return trimmedLowerValue . equals ( "1" ) || trimmedLowerValue . equals ( "true" ) || trimmedLowerValue . equals ( "yes" ) ; }
Converts a string to a boolean .
136,669
public double get ( ) { final String value = getInternal ( null , false ) ; if ( value == null ) { return noValue ( ) ; } double v = Double . parseDouble ( value ) ; return limit ( v ) ; }
Retrieves the value of this double property according to these rules .
136,670
public ClusterData createClusterData ( boolean localOnly ) { if ( localOnly ) return new VertxClusterData ( vertx ) ; HazelcastInstance hazelcast = ClusterListenerFactory . getHazelcastInstance ( vertx ) ; if ( hazelcast != null ) { return new HazelcastClusterData ( hazelcast ) ; } else { return new VertxClusterData ( ...
Creates cluster data .
136,671
public Object deserialize ( JsonObject message ) { String type = message . getString ( "type" ) ; if ( type == null ) { return message . getValue ( "value" ) ; } else { switch ( type ) { case "buffer" : return new Buffer ( message . getBinary ( "value" ) ) ; case "bytes" : return message . getBinary ( "value" ) ; case ...
Deserializes an input message .
136,672
public int get ( ) { final String value = getInternal ( null , false ) ; if ( value == null ) { return noValue ( ) ; } int v = Integer . parseInt ( value ) ; return limit ( v ) ; }
Retrieves the value of this integer property according to these rules .
136,673
public Property getPropertyDefinition ( String path ) { final List propertyList = getPropertyList ( ) ; for ( int i = 0 ; i < propertyList . size ( ) ; i ++ ) { Property property = ( Property ) propertyList . get ( i ) ; if ( property . getPath ( ) . equals ( path ) ) { return property ; } } return null ; }
Returns the definition of a named property or null if there is no such property .
136,674
private void clearDeployments ( final Handler < AsyncResult < Void > > doneHandler ) { context . execute ( new Action < Void > ( ) { public Void perform ( ) { Collection < String > sdeploymentsInfo = deployments . get ( group ) ; for ( String sdeploymentInfo : sdeploymentsInfo ) { JsonObject deploymentInfo = new JsonOb...
When the cluster is shutdown properly we need to remove deployments from the deployments map in order to ensure that deployments aren t redeployed if this node leaves the cluster .
136,675
private void doList ( final Message < JsonObject > message ) { String type = message . body ( ) . getString ( "type" ) ; if ( type != null ) { switch ( type ) { case "node" : doListNode ( message ) ; break ; default : message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "Inv...
Lists objects in the group .
136,676
private void doSelectNode ( final Message < JsonObject > message ) { final Object key = message . body ( ) . getValue ( "key" ) ; if ( key == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No key specified." ) ) ; } else { context . execute ( new Action < Str...
Selects a node in the group .
136,677
private void doDeploy ( final Message < JsonObject > message ) { String type = message . body ( ) . getString ( "type" ) ; if ( type == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No deployment type specified." ) ) ; } else { switch ( type ) { case "module...
Deploys a module or verticle .
136,678
private void addNewDeployment ( final String deploymentID , final JsonObject deploymentInfo , Handler < AsyncResult < String > > doneHandler ) { context . execute ( new Action < String > ( ) { public String perform ( ) { deployments . put ( group , deploymentInfo . copy ( ) . putString ( "id" , deploymentID ) . putStri...
Adds a deployment to the cluster deployments map .
136,679
private void doRedeploy ( final JsonObject deploymentInfo ) { if ( deploymentInfo . getString ( "type" ) . equals ( "module" ) ) { log . info ( String . format ( "%s - redeploying module %s" , DefaultGroupManager . this , deploymentInfo . getString ( "module" ) ) ) ; final CountDownLatch latch = new CountDownLatch ( 1 ...
Redeploys a deployment .
136,680
public void runTask ( Handler < Task > task ) { if ( currentTask == null ) { currentTask = new Task ( this ) ; task . handle ( currentTask ) ; } else { queue . add ( task ) ; } }
Runs a sequential task .
136,681
private void checkTasks ( ) { if ( currentTask == null ) { Handler < Task > task = queue . poll ( ) ; if ( task != null ) { currentTask = new Task ( this ) ; task . handle ( currentTask ) ; } } }
Starts the next task if necessary .
136,682
private void doInstalled ( final Message < JsonObject > message ) { String moduleName = message . body ( ) . getString ( "module" ) ; if ( moduleName == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No module specified." ) ) ; return ; } platform . getModule...
Checks if a module is installed .
136,683
private void doInstall ( final Message < JsonObject > message ) { String moduleName = message . body ( ) . getString ( "module" ) ; if ( moduleName == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No module specified." ) ) ; return ; } String uploadID = mess...
Installs a module .
136,684
private void doDeployNetwork ( final Message < JsonObject > message ) { Object network = message . body ( ) . getValue ( "network" ) ; if ( network != null ) { if ( network instanceof String ) { doDeployNetwork ( ( String ) network , message ) ; } else if ( network instanceof JsonObject ) { JsonObject jsonNetwork = ( J...
Deploys a network .
136,685
private void doDeployNetwork ( final String name , final Message < JsonObject > message ) { String scontext = data . < String , String > getMap ( String . format ( "%s.%s" , cluster , name ) ) . get ( String . format ( "%s.%s" , cluster , name ) ) ; final NetworkContext context = scontext != null ? Contexts . < Network...
Deploys a network from name .
136,686
private void doDeployNetwork ( final NetworkContext context , final Message < JsonObject > message ) { final WrappedWatchableMap < String , String > data = new WrappedWatchableMap < String , String > ( context . address ( ) , this . data . < String , String > getMap ( context . address ( ) ) , vertx ) ; data . watch ( ...
Deploys a network from context .
136,687
private void removeDeployment ( final String deploymentID , Handler < AsyncResult < Void > > doneHandler ) { context . execute ( new Action < Void > ( ) { public Void perform ( ) { Collection < String > nodeDeployments = deployments . get ( node ) ; if ( nodeDeployments != null ) { String deployment = null ; for ( Stri...
Removes a deployment from the deployments map .
136,688
@ SuppressWarnings ( "WeakerAccess" ) public SnackbarWrapper addCallbacks ( List < Callback > callbacks ) { int callbacksSize = callbacks . size ( ) ; for ( int i = 0 ; i < callbacksSize ; i ++ ) { addCallback ( callbacks . get ( i ) ) ; } return this ; }
Adds multiple callbacks to the Snackbar for various events .
136,689
private boolean isSerializableType ( Class < ? > type ) { Boolean serializable = cache . get ( type ) ; if ( serializable != null ) { return serializable ; } if ( type == Object . class ) { return true ; } if ( primitiveTypes . contains ( type ) ) { cache . put ( type , true ) ; return true ; } if ( JsonSerializable . ...
Indicates whether the given type is a serializable type .
136,690
private static SerializerFactory getInstance ( ) { if ( instance == null ) { String className = JacksonSerializerFactory . class . getName ( ) ; try { className = System . getProperty ( SERIALIZER_FACTORY_CLASS_NAME ) ; } catch ( Exception e ) { } if ( className != null ) { ClassLoader loader = Thread . currentThread (...
Gets a singleton serializer factory instance .
136,691
public static Serializer getSerializer ( Class < ? > type ) { Class < ? > serializable = lookupSerializableType ( type ) ; Serializer serializer = serializers . get ( serializable ) ; if ( serializer == null ) { serializer = getInstance ( ) . createSerializer ( serializable ) ; serializers . put ( serializable , serial...
Gets a serializer instance .
136,692
private static Class < ? > lookupSerializableType ( Class < ? > type ) { Class < ? > serializableType = serializableTypes . get ( type ) ; if ( serializableType != null ) { return serializableType ; } serializableType = findSerializableType ( type ) ; if ( serializableType != null ) { serializableTypes . put ( type , s...
Looks up the serializable type for the given type .
136,693
private static Class < ? > findSerializableType ( Class < ? > type ) { while ( type != null && type != Object . class ) { for ( Class < ? > iface : type . getInterfaces ( ) ) { if ( iface == JsonSerializable . class ) { return type ; } Class < ? > serializable = findSerializableType ( iface ) ; if ( serializable != nul...
Iterates over the class hierarchy searching for the base serializable type .
136,694
public EventBusHookListener start ( Handler < AsyncResult < Void > > doneHandler ) { eventBus . registerHandler ( address , messageHandler , doneHandler ) ; return this ; }
Starts the hook listener registering a handler on the event bus .
136,695
private void createActiveNetwork ( final NetworkContext context , final Handler < AsyncResult < ActiveNetwork > > doneHandler ) { final DefaultActiveNetwork active = new DefaultActiveNetwork ( context . config ( ) , DefaultCluster . this ) ; vertx . eventBus ( ) . registerHandler ( String . format ( "%s.%s.change" , co...
Creates and returns an active network .
136,696
@ SuppressWarnings ( "WeakerAccess" ) public SnackbarBuilder showCallback ( final SnackbarShowCallback callback ) { callbacks . add ( new SnackbarCallback ( ) { public void onSnackbarShown ( Snackbar snackbar ) { callback . onSnackbarShown ( snackbar ) ; } } ) ; return this ; }
Set the callback to be informed of the Snackbar being shown .
136,697
@ SuppressWarnings ( "WeakerAccess" ) public SnackbarBuilder dismissCallback ( final SnackbarDismissCallback callback ) { callbacks . add ( new SnackbarCallback ( ) { public void onSnackbarDismissed ( Snackbar snackbar , int dismissEvent ) { callback . onSnackbarDismissed ( snackbar , dismissEvent ) ; } } ) ; return th...
Set the callback to be informed of the Snackbar being dismissed through some means .
136,698
@ SuppressWarnings ( "WeakerAccess" ) public SnackbarBuilder actionDismissCallback ( final SnackbarActionDismissCallback callback ) { callbacks . add ( new SnackbarCallback ( ) { public void onSnackbarActionPressed ( Snackbar snackbar ) { callback . onSnackbarActionPressed ( snackbar ) ; } } ) ; return this ; }
Set the callback to be informed of the Snackbar being dismissed due to the action being pressed .
136,699
@ SuppressWarnings ( "WeakerAccess" ) public SnackbarBuilder swipeDismissCallback ( final SnackbarSwipeDismissCallback callback ) { callbacks . add ( new SnackbarCallback ( ) { public void onSnackbarSwiped ( Snackbar snackbar ) { callback . onSnackbarSwiped ( snackbar ) ; } } ) ; return this ; }
Set the callback to be informed of the Snackbar being dismissed due to being swiped away .