Tabnine Logo
SafeCallManager
Code IndexAdd Tabnine to your IDE (free)

How to use
SafeCallManager
in
org.eclipse.smarthome.core.internal.common

Best Java code snippets using org.eclipse.smarthome.core.internal.common.SafeCallManager (Showing top 6 results out of 315)

origin: eclipse/smarthome

@Override
@Nullable
public Object invoke(@Nullable Object proxy, @Nullable Method method, Object @Nullable [] args) throws Throwable {
  if (method != null) {
    try {
      getManager().enqueue(new Invocation(this, method, args));
    } catch (DuplicateExecutionException e) {
      handleDuplicate(method, e);
    }
  }
  return null;
}
origin: eclipse/smarthome

@Override
@Nullable
public Object invoke(@Nullable Object proxy, @Nullable Method method, Object @Nullable [] args) throws Throwable {
  if (method != null) {
    Invocation invocation = new Invocation(this, method, args);
    Invocation activeInvocation = getManager().getActiveInvocation();
    if (activeInvocation != null) {
      if (logger.isDebugEnabled()) {
        logger.debug(MSG_CONTEXT, toString(method), getTarget());
      }
      try {
        activeInvocation.getInvocationStack().push(invocation);
        return invokeDirect(invocation);
      } finally {
        activeInvocation.getInvocationStack().poll();
      }
    }
    try {
      Future<Object> future = getManager().getScheduler().submit(invocation);
      return future.get(getTimeout(), TimeUnit.MILLISECONDS);
    } catch (TimeoutException e) {
      handleTimeout(method, invocation);
    } catch (ExecutionException e) {
      handleExecutionException(method, e);
    }
  }
  return null;
}
origin: eclipse/smarthome

@Nullable
Object invokeDirect(Invocation invocation) throws IllegalAccessException, IllegalArgumentException {
  try {
    manager.recordCallStart(invocation);
  } catch (DuplicateExecutionException e) {
    return null;
  }
  try {
    return invocation.getMethod().invoke(target, invocation.getArgs());
  } catch (InvocationTargetException e) {
    handleException(invocation.getMethod(), e);
    return null;
  } finally {
    manager.recordCallEnd(invocation);
  }
}
origin: openhab/openhab-core

@Nullable
Object invokeDirect(Invocation invocation) throws IllegalAccessException, IllegalArgumentException {
  try {
    manager.recordCallStart(invocation);
  } catch (DuplicateExecutionException e) {
    return null;
  }
  try {
    return invocation.getMethod().invoke(target, invocation.getArgs());
  } catch (InvocationTargetException e) {
    handleException(invocation.getMethod(), e);
    return null;
  } finally {
    manager.recordCallEnd(invocation);
  }
}
origin: openhab/openhab-core

@Override
@Nullable
public Object invoke(@Nullable Object proxy, @Nullable Method method, Object @Nullable [] args) throws Throwable {
  if (method != null) {
    Invocation invocation = new Invocation(this, method, args);
    Invocation activeInvocation = getManager().getActiveInvocation();
    if (activeInvocation != null) {
      if (logger.isDebugEnabled()) {
        logger.debug(MSG_CONTEXT, toString(method), getTarget());
      }
      try {
        activeInvocation.getInvocationStack().push(invocation);
        return invokeDirect(invocation);
      } finally {
        activeInvocation.getInvocationStack().poll();
      }
    }
    try {
      Future<Object> future = getManager().getScheduler().submit(invocation);
      return future.get(getTimeout(), TimeUnit.MILLISECONDS);
    } catch (TimeoutException e) {
      handleTimeout(method, invocation);
    } catch (ExecutionException e) {
      handleExecutionException(method, e);
    }
  }
  return null;
}
origin: openhab/openhab-core

@Override
@Nullable
public Object invoke(@Nullable Object proxy, @Nullable Method method, Object @Nullable [] args) throws Throwable {
  if (method != null) {
    try {
      getManager().enqueue(new Invocation(this, method, args));
    } catch (DuplicateExecutionException e) {
      handleDuplicate(method, e);
    }
  }
  return null;
}
org.eclipse.smarthome.core.internal.commonSafeCallManager

Javadoc

Interface to the safe call manager which handles queuing and tracking of safe-call executions.

Most used methods

  • enqueue
    Queue the given invocation for asynchronous execution.
  • getActiveInvocation
    Get the active invocation if the current thread already is a safe-call thread.
  • getScheduler
    Get the safe-caller's executor service instance
  • recordCallEnd
    Track that the call to the target method finished.
  • recordCallStart
    Track that the call to the target method starts.

Popular in Java

  • Start an intent from android
  • getContentResolver (Context)
  • getSupportFragmentManager (FragmentActivity)
  • runOnUiThread (Activity)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • JLabel (javax.swing)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now