public CompletableFuture < Boolean > createTableSegment ( final String tableName , String delegationToken , final long clientRequestId ) { final CompletableFuture < Boolean > result = new CompletableFuture <> ( ) ; final Controller . NodeUri uri = getTableUri ( tableName ) ; final WireCommandType type = WireCommandType . CREATE_TABLE_SEGMENT ; final long requestId = ( clientRequestId == RequestTag . NON_EXISTENT_ID ) ? idGenerator . get ( ) : clientRequestId ; final FailingReplyProcessor replyProcessor = new FailingReplyProcessor ( ) { @ Override public void connectionDropped ( ) { log . warn ( requestId , "CreateTableSegment {} Connection dropped" , tableName ) ; result . completeExceptionally ( new WireCommandFailedException ( type , WireCommandFailedException . Reason . ConnectionDropped ) ) ; } @ Override public void wrongHost ( WireCommands . WrongHost wrongHost ) { log . warn ( requestId , "CreateTableSegment {} wrong host" , tableName ) ; result . completeExceptionally ( new WireCommandFailedException ( type , WireCommandFailedException . Reason . UnknownHost ) ) ; } @ Override public void segmentAlreadyExists ( WireCommands . SegmentAlreadyExists segmentAlreadyExists ) { log . info ( requestId , "CreateTableSegment {} segmentAlreadyExists" , tableName ) ; result . complete ( true ) ; } @ Override public void segmentCreated ( WireCommands . SegmentCreated segmentCreated ) { log . info ( requestId , "CreateTableSegment {} SegmentCreated" , tableName ) ; result . complete ( true ) ; } @ Override public void processingFailure ( Exception error ) { log . error ( requestId , "CreateTableSegment {} threw exception" , tableName , error ) ; handleError ( error , result , type ) ; } @ Override public void authTokenCheckFailed ( WireCommands . AuthTokenCheckFailed authTokenCheckFailed ) { result . completeExceptionally ( new WireCommandFailedException ( new AuthenticationException ( authTokenCheckFailed . toString ( ) ) , type , WireCommandFailedException . Reason . AuthFailed ) ) ; } } ; WireCommands . CreateTableSegment request = new WireCommands . CreateTableSegment ( requestId , tableName , delegationToken ) ; sendRequestAsync ( request , replyProcessor , result , ModelHelper . encode ( uri ) ) ; return result ; }
This method sends a WireCommand to create a table segment .