static String formatTimeout ( final CouchbaseRequest request , final long timeout ) { Map < String , Object > fieldMap = new HashMap < String , Object > ( ) ; fieldMap . put ( "t" , timeout ) ; if ( request != null ) { fieldMap . put ( "s" , formatServiceType ( request ) ) ; putIfNotNull ( fieldMap , "i" , request . operationId ( ) ) ; putIfNotNull ( fieldMap , "b" , request . bucket ( ) ) ; putIfNotNull ( fieldMap , "c" , request . lastLocalId ( ) ) ; putIfNotNull ( fieldMap , "l" , request . lastLocalSocket ( ) ) ; putIfNotNull ( fieldMap , "r" , request . lastRemoteSocket ( ) ) ; } try { return DefaultObjectMapper . writeValueAsString ( fieldMap ) ; } catch ( JsonProcessingException e ) { LOGGER . warn ( "Could not format timeout information for request " + request , e ) ; return null ; } }
This method take the given request and produces the correct additional timeout information according to the RFC .