public BrokerValue() { super(KEY, false); String[] aliases = new String[] { DEFAULT_ALIAS, FinalizingBrokerImpl.class.getName(), NON_FINALIZING_ALIAS, BrokerImpl.class.getName(), }; setAliases(aliases); setDefault(aliases[0]); setString(aliases[0]); }
public Class<? extends BrokerImpl> getTemplateBrokerType(Configuration c) { return getTemplateBroker(getClassName(), BrokerImpl.class, c, true) .getClass(); }
public String getBrokerImpl() { return brokerPlugin.getString(); }
public void setBrokerImpl(String broker) { brokerPlugin.setString(broker); }
private Set<Broker> newBrokerSet() { BrokerValue bv; if (_conf instanceof OpenJPAConfigurationImpl) bv = ((OpenJPAConfigurationImpl) _conf).brokerPlugin; else bv = (BrokerValue) _conf.getValue(BrokerValue.KEY); if (FinalizingBrokerImpl.class.isAssignableFrom(bv.getTemplateBrokerType(_conf))) { return MapBackedSet.decorate(new ConcurrentHashMap(), new Object() { }); } else { return new ConcurrentReferenceHashSet<Broker>(ConcurrentReferenceHashSet.WEAK); } }
public Object newInstance(String clsName, Class type, Configuration conf, boolean fatal) { getTemplateBroker(clsName, type, conf, fatal); try { return _templateBroker.clone(); } catch (CloneNotSupportedException e) { throw new InternalException(e); } }
public BrokerImpl newBrokerInstance(String user, String pass) { BrokerImpl broker = (BrokerImpl) brokerPlugin.instantiate(BrokerImpl.class, this); if (broker != null) broker.setAuthentication(user, pass); return broker; }
private BrokerImpl getTemplateBroker(String clsName, Class type, Configuration conf, boolean fatal) { if (clsName == null || !clsName.equals(getClassName())) throw new IllegalArgumentException("clsName != configured value '" + getClassName() + "'"); // This is not synchronized. If there are concurrent invocations // while _templateBroker is null, we'll just end up with extra // template brokers, which will get safely garbage collected. if (_templateBroker == null) _templateBroker = (BrokerImpl) super.newInstance(clsName, type, conf, fatal); return _templateBroker; } }
addValue(brokerFactoryPlugin); brokerPlugin = new BrokerValue(); addValue(brokerPlugin);
public void setBrokerImpl(String broker) { brokerPlugin.setString(broker); }
private Set<Broker> newBrokerSet() { BrokerValue bv; if (_conf instanceof OpenJPAConfigurationImpl) bv = ((OpenJPAConfigurationImpl) _conf).brokerPlugin; else bv = (BrokerValue) _conf.getValue(BrokerValue.KEY); if (FinalizingBrokerImpl.class.isAssignableFrom(bv.getTemplateBrokerType(_conf))) { return MapBackedSet.decorate(new ConcurrentHashMap(), new Object() { }); } else { return new ConcurrentReferenceHashSet<Broker>(ConcurrentReferenceHashSet.WEAK); } }
public Object newInstance(String clsName, Class type, Configuration conf, boolean fatal) { getTemplateBroker(clsName, type, conf, fatal); try { return _templateBroker.clone(); } catch (CloneNotSupportedException e) { throw new InternalException(e); } }
public BrokerImpl newBrokerInstance(String user, String pass) { BrokerImpl broker = (BrokerImpl) brokerPlugin.instantiate(BrokerImpl.class, this); if (broker != null) broker.setAuthentication(user, pass); return broker; }
private BrokerImpl getTemplateBroker(String clsName, Class type, Configuration conf, boolean fatal) { if (clsName == null || !clsName.equals(getClassName())) throw new IllegalArgumentException("clsName != configured value '" + getClassName() + "'"); // This is not synchronized. If there are concurrent invocations // while _templateBroker is null, we'll just end up with extra // template brokers, which will get safely garbage collected. if (_templateBroker == null) _templateBroker = (BrokerImpl) super.newInstance(clsName, type, conf, fatal); return _templateBroker; } }
addValue(brokerFactoryPlugin); brokerPlugin = new BrokerValue(); addValue(brokerPlugin);
public BrokerValue() { super(KEY, false); String[] aliases = new String[] { DEFAULT_ALIAS, FinalizingBrokerImpl.class.getName(), NON_FINALIZING_ALIAS, BrokerImpl.class.getName(), }; setAliases(aliases); setDefault(aliases[0]); setString(aliases[0]); }
public Class<? extends BrokerImpl> getTemplateBrokerType(Configuration c) { return getTemplateBroker(getClassName(), BrokerImpl.class, c, true) .getClass(); }
public void setBrokerImpl(String broker) { brokerPlugin.setString(broker); }
private Set<Broker> newBrokerSet() { BrokerValue bv; if (_conf instanceof OpenJPAConfigurationImpl) bv = ((OpenJPAConfigurationImpl) _conf).brokerPlugin; else bv = (BrokerValue) _conf.getValue(BrokerValue.KEY); if (FinalizingBrokerImpl.class.isAssignableFrom(bv.getTemplateBrokerType(_conf))) { return MapBackedSet.decorate(new ConcurrentHashMap(), new Object() { }); } else { return new ConcurrentReferenceHashSet<Broker>(ConcurrentReferenceHashSet.WEAK); } }
public Object newInstance(String clsName, Class type, Configuration conf, boolean fatal) { getTemplateBroker(clsName, type, conf, fatal); try { return _templateBroker.clone(); } catch (CloneNotSupportedException e) { throw new InternalException(e); } }