@Override public boolean isEmpty() { return this.targetMap.isEmpty(); }
@Override public boolean isEmpty() { return this.targetMap.isEmpty(); }
/** * Allows determining if a mapping was added. * * <p> * This is not exposed so as not to confuse users of the API, which should never need * to invoke this method. * </p> * * @return true if a mapping was added, else false */ protected boolean containsMapping() { return !this.matcherToExpression.isEmpty(); }
public void put(HttpHeaders headers) { if (headers != null) { if (headers.headersMap != null && !headers.headersMap.isEmpty()) headersMap.putAll(headers.headersMap); } }
void completeDelayedChannelClose(long currentTimeNanos) { if (delayedClosingChannels == null) return; while (!delayedClosingChannels.isEmpty()) { DelayedAuthenticationFailureClose delayedClose = delayedClosingChannels.values().iterator().next(); if (!delayedClose.tryClose(currentTimeNanos)) break; } }
@Nullable static Object eldest(LinkedHashMap map) { return map.isEmpty() ? null : map.entrySet().iterator().next(); }
private AuthenticationEntryPoint createDefaultEntryPoint(H http) { if (this.defaultEntryPointMappings.isEmpty()) { return new Http403ForbiddenEntryPoint(); } if (this.defaultEntryPointMappings.size() == 1) { return this.defaultEntryPointMappings.values().iterator().next(); } DelegatingAuthenticationEntryPoint entryPoint = new DelegatingAuthenticationEntryPoint( this.defaultEntryPointMappings); entryPoint.setDefaultEntryPoint(this.defaultEntryPointMappings.values().iterator() .next()); return entryPoint; }
@Nonnull @Override public final RunnableFuture<SnapshotResult<KeyedStateHandle>> snapshot( long checkpointId, long timestamp, @Nonnull CheckpointStreamFactory streamFactory, @Nonnull CheckpointOptions checkpointOptions) throws Exception { if (kvStateInformation.isEmpty()) { if (LOG.isDebugEnabled()) { LOG.debug("Asynchronous RocksDB snapshot performed on empty keyed state at {}. Returning null.", timestamp); } return DoneFuture.of(SnapshotResult.empty()); } else { return doSnapshot(checkpointId, timestamp, streamFactory, checkpointOptions); } }
/** * Combines this store with the given store. * * @param store The store to combine with this store. * @return A store representing a combination of this store and the given store. */ protected Store<V> combineWith(Store<V> store) { if (entries.isEmpty()) { return store; } else if (store.entries.isEmpty()) { return this; } LinkedHashMap<Harmonized<V>, Entry<V>> entries = new LinkedHashMap<Harmonized<V>, Entry<V>>(this.entries); for (Entry<V> entry : store.entries.values()) { Entry<V> previousEntry = entries.remove(entry.getKey()), injectedEntry = previousEntry == null ? entry : combine(previousEntry, entry); entries.put(injectedEntry.getKey(), injectedEntry); } return new Store<V>(entries); }
private void finalizeBlock() { synchronized (this) { if (fromBlock >= toBlock && queuedBlocks.isEmpty()) finishDownload(); cnt++; if (cnt % 1000 == 0) logger.info("FastSync: downloaded receipts for " + cnt + " blocks."); } dbFlushManager.commit(); }
private boolean isCorrectEvent(Message message, CommActions commActions) { LinkedHashMap<String, LinkedHashMap> data = (LinkedHashMap) message.getContent().get("data"); LinkedHashMap content = data.get("content"); if (null != content && !content.isEmpty()) { String event = (String) content.getOrDefault("event", ""); return commActions.getAction().equals(event); } return false; }
private AccessDeniedHandler createDefaultDeniedHandler(H http) { if (this.defaultDeniedHandlerMappings.isEmpty()) { return new AccessDeniedHandlerImpl(); } if (this.defaultDeniedHandlerMappings.size() == 1) { return this.defaultDeniedHandlerMappings.values().iterator().next(); } return new RequestMatcherDelegatingAccessDeniedHandler( this.defaultDeniedHandlerMappings, new AccessDeniedHandlerImpl()); }
/** * Injects the given store into this store. * * @param store The key store to inject into this store. * @return A store that represents this store with the given store injected. */ protected Store<V> inject(Store<V> store) { if (entries.isEmpty()) { return store; } else if (store.entries.isEmpty()) { return this; } LinkedHashMap<Harmonized<V>, Entry<V>> entries = new LinkedHashMap<Harmonized<V>, Entry<V>>(this.entries); for (Entry<V> entry : store.entries.values()) { Entry<V> dominantEntry = entries.remove(entry.getKey()), injectedEntry = dominantEntry == null ? entry : dominantEntry.inject(entry.getKey(), entry.getVisibility()); entries.put(injectedEntry.getKey(), injectedEntry); } return new Store<V>(entries); }
@Override final ExpressionBasedFilterInvocationSecurityMetadataSource createMetadataSource( H http) { LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = REGISTRY .createRequestMap(); if (requestMap.isEmpty()) { throw new IllegalStateException( "At least one mapping is required (i.e. authorizeRequests().anyRequest().authenticated())"); } return new ExpressionBasedFilterInvocationSecurityMetadataSource(requestMap, getExpressionHandler(http)); }
public void onEvent(int type) { if (JZ_USER_EVENT != null && isCurrentPlay() && !jzDataSource.urlsMap.isEmpty()) { JZ_USER_EVENT.onEvent(type, jzDataSource.getCurrentUrl(), currentScreen); } }
/** 通用的拼接请求头 */ public static Request.Builder appendHeaders(Request.Builder builder, HttpHeaders headers) { if (headers.headersMap.isEmpty()) return builder; Headers.Builder headerBuilder = new Headers.Builder(); try { for (Map.Entry<String, String> entry : headers.headersMap.entrySet()) { //对头信息进行 utf-8 编码,防止头信息传中文,这里暂时不编码,可能出现未知问题,如有需要自行编码 // String headerValue = URLEncoder.encode(entry.getValue(), "UTF-8"); headerBuilder.add(entry.getKey(), entry.getValue()); } } catch (Exception e) { OkLogger.printStackTrace(e); } builder.headers(headerBuilder.build()); return builder; }
@Override public void release() { if ( getStatements() != null && !getStatements().isEmpty() ) { LOG.batchContainedStatementsOnRelease(); } releaseStatements(); observers.clear(); } }
private LogoutSuccessHandler createDefaultSuccessHandler() { SimpleUrlLogoutSuccessHandler urlLogoutHandler = new SimpleUrlLogoutSuccessHandler(); urlLogoutHandler.setDefaultTargetUrl(logoutSuccessUrl); if (defaultLogoutSuccessHandlerMappings.isEmpty()) { return urlLogoutHandler; } DelegatingLogoutSuccessHandler successHandler = new DelegatingLogoutSuccessHandler(defaultLogoutSuccessHandlerMappings); successHandler.setDefaultLogoutSuccessHandler(urlLogoutHandler); return successHandler; }
@Override public final void execute() { notifyObserversExplicitExecution(); if ( getStatements().isEmpty() ) { return; } try { doExecuteBatch(); } finally { releaseStatements(); } }