List of usage examples for java.lang Boolean booleanValue
@HotSpotIntrinsicCandidate public boolean booleanValue()
From source file:org.lieuofs.etat.biz.GestionEtat.java
private boolean filtreBooleen(Boolean valeurCritere, boolean valeur) { if (null != valeurCritere && valeurCritere.booleanValue() != valeur) return false; return true;//from ww w. j a va 2 s .co m }
From source file:httpfailover.DefaultFailoverRetryHandler.java
public boolean tryNextHost(final IOException exception, final HttpContext context) { if (exception == null) { throw new IllegalArgumentException("Exception parameter may not be null"); }/*from w w w. j ava 2s . c o m*/ HttpRequest request = (HttpRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST); if (requestIsAborted(request)) { return false; } if (handleAsIdempotent(request)) { // Retry if the request is considered idempotent return true; } Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT); boolean sent = (b != null && b.booleanValue()); if (!sent || this.requestSentRetryEnabled) { // Retry if the request has not been sent fully or // if it's OK to retry methods that have been sent return true; } // otherwise do not retry return false; }
From source file:com.redhat.rhn.frontend.nav.test.NavNodeTest.java
private void verifyBooleanSetterMethod(String methodname) throws Exception { Object[] args = { Boolean.TRUE }; MethodUtils.invokeMethod(node, "set" + methodname, args); Boolean rc = (Boolean) MethodUtils.invokeMethod(node, "get" + methodname, null); assertTrue(rc.booleanValue()); }
From source file:cn.salesuite.saf.http.RetryHandler.java
public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { boolean retry; Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT); boolean sent = (b != null && b.booleanValue()); if (executionCount > maxRetries) { // Do not retry if over max retry count retry = false;//from w ww . ja v a 2 s. c o m } else if (exceptionBlacklist.contains(exception.getClass())) { // immediately cancel retry if the error is blacklisted retry = false; } else if (exceptionWhitelist.contains(exception.getClass())) { // immediately retry if error is whitelisted retry = true; } else if (!sent) { // for most other errors, retry only if request hasn't been fully sent yet retry = true; } else { // resend all idempotent requests HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST); String requestType = currentReq.getMethod(); if (!requestType.equals("POST")) { retry = true; } else { // otherwise do not retry retry = false; } } if (retry) { SystemClock.sleep(RETRY_SLEEP_TIME_MILLIS); } else { exception.printStackTrace(); } return retry; }
From source file:com.google.httputils.RetryHandler.java
@Override public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { boolean retry; Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT); boolean sent = (b != null && b.booleanValue()); if (executionCount > maxRetries) { // Do not retry if over max retry count retry = false;//from w w w .j a va2s . c o m } else if (exceptionBlacklist.contains(exception.getClass())) { // immediately cancel retry if the error is blacklisted retry = false; } else if (exceptionWhitelist.contains(exception.getClass())) { // immediately retry if error is whitelisted retry = true; } else if (!sent) { // for most other errors, retry only if request hasn't been fully sent yet retry = true; } else { // resend all idempotent requests HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST); String requestType = currentReq.getMethod(); if (!requestType.equals("POST")) { retry = true; } else { // otherwise do not retry retry = false; } } if (retry) { SystemClock.sleep(RETRY_SLEEP_TIME_MILLIS); } else { exception.printStackTrace(); } return retry; }
From source file:com.glaf.activiti.tasklistener.CancelAllTaskListener.java
@Override public void notify(DelegateTask delegateTask) { logger.debug("----------------------------------------------------"); logger.debug("---------------CancelAllTaskListener----------------"); logger.debug("----------------------------------------------------"); logger.debug("cucrent task: " + delegateTask.getName()); logger.debug("cucrent taskDefinitionKey: " + delegateTask.getTaskDefinitionKey()); if (conditionExpression != null) { logger.debug("variables:" + delegateTask.getVariables()); logger.debug("conditionExpression:" + conditionExpression.getExpressionText()); Object value = conditionExpression.getValue(delegateTask); if (value != null) { logger.debug("condition:" + value); if (value instanceof Boolean) { Boolean b = (Boolean) value; if (!b.booleanValue()) { return; }/* w w w . ja v a 2s . c om*/ } } } CommandContext commandContext = Context.getCommandContext(); TaskQueryImpl taskQuery = new TaskQueryImpl(); taskQuery.processInstanceId(delegateTask.getProcessInstanceId()); List<Task> tasks = commandContext.getTaskEntityManager().findTasksByQueryCriteria(taskQuery); logger.debug("tasks:" + tasks); if (tasks != null && !tasks.isEmpty()) { String includes = null; if (includesExpression != null) { includes = (String) includesExpression.getValue(delegateTask); } List<String> list = new java.util.ArrayList<String>(); if (includes != null && includes.trim().length() > 0) { list = StringTools.split(includes); } cache.put("ACT_TASK_" + delegateTask.getId(), "1"); Iterator<Task> iterator = tasks.iterator(); while (iterator.hasNext()) { Task task = iterator.next(); String cacheKey = "ACT_TASK_" + task.getId(); if (StringUtils.equals(task.getTaskDefinitionKey(), delegateTask.getTaskDefinitionKey())) { logger.debug(task.getTaskDefinitionKey() + " [" + task.getName() + "] skiped."); cache.put(cacheKey, "1"); continue; } if (list != null && !list.isEmpty()) { if (!list.contains(task.getTaskDefinitionKey())) { continue; } } if (task instanceof TaskEntity) { TaskEntity taskEntity = (TaskEntity) task; if (cache.getIfPresent(cacheKey) == null) { cache.put(cacheKey, "1"); logger.debug( taskEntity.getTaskDefinitionKey() + " [" + taskEntity.getName() + "] canceled"); //taskEntity.complete(); } } } } }
From source file:com.DGSD.DGUtils.Http.BetterHttpRequestRetryHandler.java
public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { boolean retry; this.timesRetried = executionCount; Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT); boolean sent = (b != null && b.booleanValue()); if (executionCount > maxRetries) { // Do not retry if over max retry count retry = false;//from www . ja v a2 s . co m } else if (exceptionBlacklist.contains(exception.getClass())) { // immediately cancel retry if the error is blacklisted retry = false; } else if (exceptionWhitelist.contains(exception.getClass())) { // immediately retry if error is whitelisted retry = true; } else if (!sent) { // for all other errors, retry only if request hasn't been fully sent yet // TODO: refine to resend all idempotent requests retry = true; } else { // otherwise do not retry retry = false; } if (retry) { Log.e(BetterHttp.LOG_TAG, "request failed (" + exception.getClass().getCanonicalName() + ": " + exception.getMessage() + " / attempt " + executionCount + "), will retry in " + RETRY_SLEEP_TIME_MILLIS / 1000.0 + " seconds"); SystemClock.sleep(RETRY_SLEEP_TIME_MILLIS); } else { Log.e(BetterHttp.LOG_TAG, "request failed after " + executionCount + " attempts"); exception.printStackTrace(); } return retry; }
From source file:com.android.pchelper.http.RetryHandler.java
public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { boolean retry = true; Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT); boolean sent = (b != null && b.booleanValue()); if (executionCount > maxRetries) { // Do not retry if over max retry count retry = false;//w w w . j av a 2 s. c o m } else if (isInList(exceptionBlacklist, exception)) { // immediately cancel retry if the error is blacklisted retry = false; } else if (isInList(exceptionWhitelist, exception)) { // immediately retry if error is whitelisted retry = true; } else if (!sent) { // for most other errors, retry only if request hasn't been fully sent yet retry = true; } if (retry) { // resend all idempotent requests HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST); String requestType = currentReq.getMethod(); retry = !requestType.equals("POST"); } if (retry) { SystemClock.sleep(RETRY_SLEEP_TIME_MILLIS); } else { exception.printStackTrace(); } return retry; }
From source file:com.uwindsor.elgg.project.http.RetryHandler.java
@Override public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { boolean retry; Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT); boolean sent = (b != null && b.booleanValue()); if (executionCount > maxRetries) { // Do not retry if over max retry count retry = false;/*from w w w . j a v a 2s .com*/ } else if (exceptionBlacklist.contains(exception.getClass())) { // immediately cancel retry if the error is blacklisted retry = false; } else if (exceptionWhitelist.contains(exception.getClass())) { // immediately retry if error is whitelisted retry = true; } else if (!sent) { // for most other errors, retry only if request hasn't been fully sent yet retry = true; } else { // resend all idempotent requests HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST); String requestType = currentReq.getMethod(); if (!requestType.equals("POST")) { retry = true; } else { // otherwise do not retry retry = false; } } if (retry) { SystemClock.sleep(RETRY_SLEEP_TIME_MILLIS); } else { exception.printStackTrace(); } return retry; }