idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
12,900
void doBatchStart ( String batch , Object args ) { checkOpen ( ) ; JsonObject message = createMessage ( args ) . putString ( "batch" , batch ) . putString ( "action" , "startBatch" ) ; if ( open && ! paused ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "%s - Batch start: Batch[batch=%s]" , this ...
Sends a batch start message .
12,901
void doBatchEnd ( String batch , Object args ) { checkOpen ( ) ; JsonObject message = createMessage ( args ) . putString ( "action" , "endBatch" ) . putString ( "batch" , batch ) ; if ( open && ! paused ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "%s - Batch end: Batch[batch=%s, args=%s]" , th...
Sends a batch end message .
12,902
private JsonObject createMessage ( Object value ) { JsonObject message = serializer . serialize ( value ) ; long id = currentMessage ++ ; message . putNumber ( "id" , id ) ; messages . put ( id , message ) ; return message ; }
Creates a value message .
12,903
public static void checkNull ( Object value , String message , Object ... args ) { if ( value != null ) { throw new IllegalArgumentException ( String . format ( message , args ) ) ; } }
Validates that an argument is null .
12,904
public static void checkNotNull ( Object value , String message , Object ... args ) { if ( value == null ) { throw new NullPointerException ( String . format ( message , args ) ) ; } }
Validates that an argument is not null .
12,905
public static void checkPositive ( int number , String message , Object ... args ) { if ( number < 0 ) { throw new IllegalArgumentException ( String . format ( message , args ) ) ; } }
Validates that an argument is positive .
12,906
public static void checkUri ( String uri , String message , Object ... args ) { try { new URI ( uri ) ; } catch ( URISyntaxException e ) { throw new IllegalArgumentException ( String . format ( message , args ) , e ) ; } }
Validates that an argument is a valid URI .
12,907
void start ( final Handler < OutputGroup > startHandler ) { connection . doGroupStart ( id , name , args , parent ) ; this . startHandler = startHandler ; }
Starts the output group .
12,908
public static PortLogger getLogger ( Class < ? > clazz , OutputCollector output ) { return getLogger ( clazz . getCanonicalName ( ) , output ) ; }
Creates an output port logger for the given type .
12,909
public static PortLogger getLogger ( String name , OutputCollector output ) { Args . checkNotNull ( name , "logger name cannot be null" ) ; Map < OutputCollector , PortLogger > loggers = PortLoggerFactory . loggers . get ( name ) ; if ( loggers == null ) { loggers = new HashMap < > ( ) ; PortLoggerFactory . loggers . p...
Creates an output port logger with the given name .
12,910
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 .
12,911
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 .
12,912
@ 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 .
12,913
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 .
12,914
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 .
12,915
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 .
12,916
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 .
12,917
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 .
12,918
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 .
12,919
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 .
12,920
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 .
12,921
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 .
12,922
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 .
12,923
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 .
12,924
private void removeNode ( String address , String node ) { Set < String > registry = vertx . sharedData ( ) . getSet ( address ) ; registry . remove ( node ) ; }
Removes a node from the local registry .
12,925
@ 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 .
12,926
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 .
12,927
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 .
12,928
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 .
12,929
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 .
12,930
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 .
12,931
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 .
12,932
public Vertigo deployCluster ( Handler < AsyncResult < Cluster > > doneHandler ) { return deployCluster ( ContextUri . createUniqueScheme ( ) , doneHandler ) ; }
Deploys a randomly named unique cluster .
12,933
public Vertigo getCluster ( String address , Handler < AsyncResult < Cluster > > resultHandler ) { Cluster cluster = new DefaultCluster ( address , vertx , container ) ; cluster . ping ( resultHandler ) ; return this ; }
Loads a cluster .
12,934
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 .
12,935
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 .
12,936
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 .
12,937
public static JsonObject serialize ( InstanceContext context ) { return serialize ( context . uri ( ) , context . component ( ) . network ( ) ) ; }
Serializes an instance context to JSON .
12,938
public static JsonObject serialize ( InputPortContext context ) { return serialize ( context . uri ( ) , context . input ( ) . instance ( ) . component ( ) . network ( ) ) ; }
Serializes an input port context to JSON .
12,939
public static JsonObject serialize ( OutputPortContext context ) { return serialize ( context . uri ( ) , context . output ( ) . instance ( ) . component ( ) . network ( ) ) ; }
Serializes an output port context to JSON .
12,940
public static < T extends Context < T > > T deserialize ( JsonObject context ) { return deserialize ( context . getString ( "uri" ) , context . getObject ( "context" ) ) ; }
Deserializes a context from JSON .
12,941
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 .
12,942
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 .
12,943
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 .
12,944
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 .
12,945
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 .
12,946
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 .
12,947
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 .
12,948
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 .
12,949
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 .
12,950
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 .
12,951
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 .
12,952
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 .
12,953
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 .
12,954
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 .
12,955
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 .
12,956
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 .
12,957
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 .
12,958
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 .
12,959
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 .
12,960
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 .
12,961
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 .
12,962
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 .
12,963
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 .
12,964
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 .
12,965
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 .
12,966
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 .
12,967
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 .
12,968
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 .
12,969
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 .
12,970
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 .
12,971
public Integer getInstance ( ) { try { return Integer . valueOf ( uri . getPath ( ) . split ( "/" ) [ 2 ] ) ; } catch ( IndexOutOfBoundsException e ) { return null ; } }
Returns the instance number .
12,972
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 .
12,973
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 .
12,974
@ SuppressWarnings ( "unchecked" ) public < T > T getQuery ( String name ) { return ( T ) getQuery ( ) . get ( name ) ; }
Returns a specific query argument .
12,975
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 .
12,976
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 .
12,977
public boolean booleanValue ( ) { final String value = getInternal ( null , false ) ; if ( value == null ) { return false ; } return toBoolean ( value ) ; }
Returns the boolean value of this property .
12,978
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 .
12,979
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 .
12,980
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 .
12,981
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 .
12,982
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 .
12,983
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 .
12,984
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 .
12,985
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 .
12,986
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 .
12,987
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 .
12,988
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 .
12,989
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 .
12,990
public void runTask ( Handler < Task > task ) { if ( currentTask == null ) { currentTask = new Task ( this ) ; task . handle ( currentTask ) ; } else { queue . add ( task ) ; } }
Runs a sequential task .
12,991
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 .
12,992
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 .
12,993
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 .
12,994
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 .
12,995
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 .
12,996
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 .
12,997
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 .
12,998
@ 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 .
12,999
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 .