Coroutines in Kotlin
operation Continuation interface Continuation{ fun resume(data: P) fun resumeWithException(e: Throwable) }
Library Function (coroutine builder) asyncUI { val image = await(loadImage(url)) Support Continuation interface Continuation { fun resume(data: P) fun resumeWithException(e: Throwable) }
Summary: Goals • Asynchronous programing (and more) – without explicit callbacks CompletableFuture , c: Continuation ) { f.whenComplete { value, throwable -> if (throwable == null) c.resume(value) else c.resumeWithException(throwable) } } async() fun moreWork() = async { println("Work 0 码力 | 39 页 | 1.01 MB | 1 年前32022年美团技术年货 合辑
logMessage(final String fqcn, final Level level, final Marker marker, final Message msg, final Throwable t) { StackTraceElement element = null; if (fqcn != null) { element = getStackTraceElement(fqcn (final Exception e) { // LOG4J2-1127 final Throwable throwable = Throwables.getRootCause(e); if (throwable instanceof UnsupportedOperationException) { 后端 < 725 String fqcn, final Level level, final 后端 < 729 Marker marker, final Message msg, final Throwable t) { StackTraceElement element = null; if (fqcn != null) { element = getStackTraceElement(fqcn0 码力 | 1356 页 | 45.90 MB | 1 年前3The PHP Handbook
will be executed if there’s an exception in the try block: try { //do something } catch (Throwable $e) { //we can do something here if an exception happens } Notice that we have an Exception object to get more information about the exception, like this: try { //do something } catch (Throwable $e) { echo $e->getMessage(); } Let’s do an example. For example by mistake I divide a number block, the program ends successfully, telling me the problem: try { echo 1 / 0; } catch (Throwable $e) { echo $e->getMessage(); } 62 Of course this is a simple example but you can see the0 码力 | 97 页 | 8.78 MB | 1 年前3Spring Framwork Core Technologies v5.3.36 SNAPSHOT
implements MethodReplacer { public Object reimplement(Object o, Method m, Object[] args) throws Throwable { // get the input value, work with it, and return a computed result String input the advice body. You can use the throwing attribute to both restrict matching (if desired — use Throwable as the exception type otherwise) and bind the thrown exception to an advice parameter. The following CommonPointcuts.businessService()") public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable { // start stopwatch Object retVal = pjp.proceed(); // stop stopwatch0 码力 | 485 页 | 6.31 MB | 1 年前3Spring Framework 2.0.8 Reference
implements MethodReplacer { public Object reimplement(Object o, Method m, Object[] args) throws Throwable { // get the input value, work with it, and return a computed result String input = (String) args[0]; exception in the advice body. Use the throwing attribute to both restrict matching (if desired, use Throwable as the exception type otherwise) and bind the thrown exception to an advice parameter. import org SystemArchitecture.businessService()") public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable { // start stopwatch Object retVal = pjp.proceed(); // stop stopwatch return retVal; } } The value0 码力 | 502 页 | 3.61 MB | 1 年前3Spring Framework 2.0.3 Reference
implements MethodReplacer { public Object reimplement(Object o, Method m, Object[] args) throws Throwable { // get the input value, work with it, and return a computed result String input = (String) args[0]; exception in the advice body. Use the throwing attribute to both restrict matching (if desired, use Throwable as the exception type otherwise) and bind the thrown exception to an advice parameter. Aspect Oriented SystemArchitecture.businessService()") public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable { // start stopwatch Object retVal = pjp.proceed(); // stop stopwatch return retVal; } } The value0 码力 | 495 页 | 3.57 MB | 1 年前3Spring Framework 2.0.2 Reference
implements MethodReplacer { public Object reimplement(Object o, Method m, Object[] args) throws Throwable { // get the input value, work with it, and return a computed result String input = (String) args[0]; exception in the advice body. Use the throwing attribute to both restrict matching (if desired, use Throwable as the exception type otherwise) and bind the thrown exception to an advice parameter. import org SystemArchitecture.businessService()") public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable { // start stopwatch Object retVal = pjp.proceed(); // stop stopwatch return retVal; } } The value0 码力 | 498 页 | 3.55 MB | 1 年前3Spring Framework 2.0.7 Reference
implements MethodReplacer { public Object reimplement(Object o, Method m, Object[] args) throws Throwable { // get the input value, work with it, and return a computed result String input = (String) args[0]; exception in the advice body. Use the throwing attribute to both restrict matching (if desired, use Throwable as the exception type otherwise) and bind the thrown exception to an advice parameter. import org SystemArchitecture.businessService()") public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable { // start stopwatch Object retVal = pjp.proceed(); // stop stopwatch return retVal; } } The value0 码力 | 502 页 | 3.61 MB | 1 年前3Spring Framework 2.0.1 Reference
implements MethodReplacer { public Object reimplement(Object o, Method m, Object[] args) throws Throwable { // get the input value, work with it, and return a computed result String input = (String) args[0]; exception in the advice body. Use the throwing attribute to both restrict matching (if desired, use Throwable as the exception type otherwise) and bind the thrown exception to an advice parameter. import org SystemArchitecture.businessService()") public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable { // start stopwatch Object retVal = pjp.proceed(); // stop stopwatch return retVal; } } The value0 码力 | 496 页 | 3.55 MB | 1 年前3Spring Framework 2.0.5 Reference
implements MethodReplacer { public Object reimplement(Object o, Method m, Object[] args) throws Throwable { // get the input value, work with it, and return a computed result String input = (String) args[0]; exception in the advice body. Use the throwing attribute to both restrict matching (if desired, use Throwable as the exception type otherwise) and bind the thrown exception to an advice parameter. import org SystemArchitecture.businessService()") public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable { // start stopwatch Object retVal = pjp.proceed(); // stop stopwatch return retVal; } } The value0 码力 | 499 页 | 3.59 MB | 1 年前3
共 289 条
- 1
- 2
- 3
- 4
- 5
- 6
- 29