Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ix.util.context
Class ContextLockingProxy.Handler

    java.lang.Object
      ix.util.context.ContextLockingProxy.Handler

All Implemented Interfaces:
  java.lang.reflect.InvocationHandler

Enclosing class:
  ContextLockingProxy

    public static class ContextLockingProxy.Handler

extends java.lang.Object
implements java.lang.reflect.InvocationHandler

The invocation-handler for a context-locking proxy. When the handler is created, it grabs the current context which is assumed to be the right context for the first method call handled by the proxy. That's saved as the "instance context". Then, whenever the handler is given a method to call, it does the following while synchronized on the current `ContextHolder`:

1. Remember the current context.
2. Set the current context to the saved instance context.
3. Invoke the method, and then in a "finally" clause:
4. Record as the instance context whatever context is current now that the method's returned, and
5. restore the context remembered earlier.

Field Summary
`protected java.lang.Object` | `instance`
`protected Context` | `instanceContext`

Constructor Summary
`ContextLockingProxy.Handler(java.lang.Object instance)`

Method Summary
`java.lang.Object` | `invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### instance

    protected java.lang.Object instance

### instanceContext

    protected Context instanceContext

Constructor Detail

### ContextLockingProxy.Handler

    public ContextLockingProxy.Handler(java.lang.Object instance)

Method Detail

### invoke

    public java.lang.Object invoke(java.lang.Object proxy,
                                   java.lang.reflect.Method method,
                                   java.lang.Object[] args)
                            throws java.lang.Throwable

  Specified by:
    `invoke` in interface `java.lang.reflect.InvocationHandler`
  Throws:
    `java.lang.Throwable`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD