Refine search
private static String buildMessage( Set<Pair<SchemaDescriptor, UnderlyingStorageException>> exceptions ) { StringBuilder builder = new StringBuilder( ); builder.append("Errors when closing (flushing) index updaters:"); for ( Pair<SchemaDescriptor, UnderlyingStorageException> pair : exceptions ) { builder.append( format( " (%s) %s", pair.first().toString(), pair.other().getMessage() ) ); } return builder.toString(); }
private void startDeferredExecutors( JobScheduler jobScheduler, Iterable<Pair<DeferredExecutor,Group>> deferredExecutors ) { for ( Pair<DeferredExecutor,Group> executorGroupPair : deferredExecutors ) { DeferredExecutor executor = executorGroupPair.first(); Group group = executorGroupPair.other(); executor.satisfyWith( jobScheduler.executor( group ) ); } }
@SuppressWarnings( "unchecked" ) public void afterRollback( ReadableTransactionState state, KernelTransaction tx, TransactionHooksState hooksState ) { if ( hooksState == null ) { return; } for ( Pair<TransactionHook, Outcome> hookAndOutcome : hooksState.hooksWithOutcome() ) { hookAndOutcome.first().afterRollback( state, tx, hookAndOutcome.other() ); } }
@SuppressWarnings( "unchecked" ) public void afterCommit( ReadableTransactionState state, KernelTransaction tx, TransactionHooksState hooksState ) { if ( hooksState == null ) { return; } for ( Pair<TransactionHook, Outcome> hookAndOutcome : hooksState.hooksWithOutcome() ) { TransactionHook hook = hookAndOutcome.first(); Outcome outcome = hookAndOutcome.other(); hook.afterCommit( state, tx, outcome ); } }
private String createParameterString( Pair<String, String>[] params ) { String paramString = ""; for ( Pair<String, String> param : params ) { String delimiter = paramString.isEmpty() || paramString.endsWith( "{" ) ? "" : ","; paramString += delimiter + "\"" + param.first() + "\":\"" + param.other() + "\""; } return paramString; }
@Override ActiveState<Key> start( DataInitializer<EntryUpdater<Key>> initializer ) throws IOException { if ( initializer == null ) { throw new IllegalStateException( "Store needs to be created, and no initializer is given." ); } Pair<File, KeyValueStoreFile> created = initialState( initializer ); return stateFactory.open( ReadableState.store( keyFormat(), created.other() ), created.first(), versionContextSupplier ); }
private static Map<String, String> parseConfigOverrides( Args arguments ) { Collection<Pair<String, String>> options = arguments.interpretOptions( "c", Converters.optional(), s -> { if ( s.contains( "=" ) ) { String[] keyVal = s.split( "=", 2 ); return pair( keyVal[0], keyVal[1] ); } // Shortcut to specify boolean flags ("-c dbms.enableTheFeature") return pair( s, "true" ); } ); Map<String,String> ret = stringMap(); options.forEach( pair -> ret.put( pair.first(), pair.other() ) ); return ret; }
IndexType getIndexType( IndexIdentifier identifier, boolean recovery ) throws ExplicitIndexNotFoundKernelException { Pair<Integer, IndexType> type = cache.get( identifier ); Map<String, String> config = indexStore.get( identifier.entityType.entityClass(), identifier.indexName ); if ( config == null ) { if ( recovery ) { return null; } throw new ExplicitIndexNotFoundKernelException( "Index '%s' doesn't exist.", identifier ); } if ( type != null && config.hashCode() == type.first() ) { return type.other(); } type = Pair.of( config.hashCode(), IndexType.getIndexType( config ) ); cache.put( identifier, type ); return type.other(); }
private List<PropertyContainer> sortedEntities( LinkedList<Pair<PropertyContainer, Long>> timestamps, final boolean reversed ) { List<Pair<PropertyContainer, Long>> sorted = new ArrayList<>( timestamps ); sorted.sort( ( o1, o2 ) -> !reversed ? o1.other().compareTo( o2.other() ) : o2.other().compareTo( o1.other() ) ); List<PropertyContainer> result = new ArrayList<>(); for ( Pair<PropertyContainer, Long> timestamp : sorted ) { result.add( timestamp.first() ); } return result; }