01: /*****************************************************************************
02: * Copyright (C) PicoContainer Organization. All rights reserved. *
03: * ------------------------------------------------------------------------- *
04: * The software in this package is published under the terms of the BSD *
05: * style license a copy of which has been included with this distribution in *
06: * the LICENSE.txt file. *
07: * *
08: * Original code by *
09: *****************************************************************************/package org.picocontainer.behaviors;
10:
11: import org.picocontainer.ComponentAdapter;
12: import org.picocontainer.PicoContainer;
13: import org.picocontainer.PicoCompositionException;
14: import org.picocontainer.behaviors.AbstractBehavior;
15:
16: /**
17: * Component Adapter that uses java synchronized around getComponentInstance().
18: * @author Aslak Hellesøy
19: * @author Manish Shah
20: */
21: public class Synchronized<T> extends AbstractBehavior<T> {
22: /**
23: * Serialization UUID.
24: */
25: private static final long serialVersionUID = -3984071461712339652L;
26:
27: public Synchronized(ComponentAdapter<T> delegate) {
28: super (delegate);
29: }
30:
31: public synchronized T getComponentInstance(PicoContainer container)
32: throws PicoCompositionException {
33: return super .getComponentInstance(container);
34: }
35:
36: public String getDescriptor() {
37: return "Synchronized";
38: }
39:
40: }
|