Package com.thoughtworks.proxy.kit

Examples of com.thoughtworks.proxy.kit.SimpleReference


     * @return the created proxy implementing the <tt>types</tt> and {@link Swappable}
     * @since 0.2
     */
    public static Object object(
            final Class[] types, final ProxyFactory proxyFactory, final Object delegate, final int delegationMode) {
        final ObjectReference delegateReference = new SimpleReference(delegate);
        return new HotSwappingInvoker(types, proxyFactory, delegateReference, delegationMode).proxy();
    }
View Full Code Here


     */
    public synchronized void add(final Object instance) {
        if (instance == null) {
            throw new NullPointerException();
        }
        availableInstances.add(new SimpleReference(instance));
        notifyAll();
    }
View Full Code Here

        if (instances != null) {
            for (int i = 0; i < instances.length; ++i) {
                if (instances[i] == null) {
                    throw new NullPointerException();
                }
                availableInstances.add(new SimpleReference(instances[i]));
            }
            notifyAll();
        }
    }
View Full Code Here

            final List resettedInstances = new ArrayList();
            for (Iterator iter = freedInstances.iterator(); iter.hasNext();) {
                final Object element = iter.next();
                busyInstances.remove(element);
                if (resetter.reset(element)) {
                    resettedInstances.add(new SimpleReference(element));
                }
            }
            availableInstances.addAll(resettedInstances);
            if (freedInstances.size() > 0) {
                notifyAll();
View Full Code Here

    private synchronized void writeObject(final ObjectOutputStream out) throws IOException {
        out.defaultWriteObject();
        final List instances = new ArrayList(availableInstances);
        for (final Iterator iter = busyInstances.keySet().iterator(); iter.hasNext();) {
            instances.add(new SimpleReference(iter.next()));
        }
        int mode = serializationMode;
        if (mode == SERIALIZATION_FORCE) {
            try {
                final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
View Full Code Here

     * @since 0.2
     */
    public static Object object(final Class[] types, final Object[] delegates, final ProxyFactory factory) {
        final ObjectReference[] references = new ObjectReference[delegates.length];
        for (int i = 0; i < references.length; i++) {
            references[i] = new SimpleReference(delegates[i]);
        }
        return factory.createProxy(types, new DispatchingInvoker(factory, types, references));
    }
View Full Code Here

     * @throws IllegalArgumentException if <tt>exceptionClass</tt> is not a {@link Throwable}
     * @since 0.1
     */
    public FailoverInvoker(
            final Class[] types, final ProxyFactory proxyFactory, final Object[] delegates, final Class exceptionClass) {
        super(types, proxyFactory, new SimpleReference(delegates[0]), Delegating.MODE_DIRECT);
        if (!Throwable.class.isAssignableFrom(exceptionClass)) {
            throw new IllegalArgumentException("exceptionClass is not a Throwable");
        }
        this.delegates = delegates;
        this.exceptionClass = exceptionClass;
View Full Code Here

     * @return a new proxy of the specified type.
     * @since 0.2.1
     */
    public static Object object(final Class type, final Object delegate, final ProxyFactory factory, final int delegationMode) {
        return factory.createProxy(new Class[]{type}, new DelegatingInvoker(
                factory, new SimpleReference(delegate), delegationMode));
    }
View Full Code Here

     *
     * @param delegate the delegated object
     * @since 0.1
     */
    public DelegatingInvoker(final Object delegate) {
        this(new StandardProxyFactory(), new SimpleReference(delegate), Delegating.MODE_SIGNATURE);
    }
View Full Code Here

TOP

Related Classes of com.thoughtworks.proxy.kit.SimpleReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.