java.util.Hashtable Java Examples

The following examples show how to use java.util.Hashtable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PropertyChangeSupport.java    From openjdk-8 with GNU General Public License v2.0 7 votes vote down vote up
private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException {
    this.map = new PropertyChangeListenerMap();

    ObjectInputStream.GetField fields = s.readFields();

    @SuppressWarnings("unchecked")
    Hashtable<String, PropertyChangeSupport> children = (Hashtable<String, PropertyChangeSupport>) fields.get("children", null);
    this.source = fields.get("source", null);
    fields.get("propertyChangeSupportSerializedDataVersion", 2);

    Object listenerOrNull;
    while (null != (listenerOrNull = s.readObject())) {
        this.map.add(null, (PropertyChangeListener)listenerOrNull);
    }
    if (children != null) {
        for (Entry<String, PropertyChangeSupport> entry : children.entrySet()) {
            for (PropertyChangeListener listener : entry.getValue().getPropertyChangeListeners()) {
                this.map.add(entry.getKey(), listener);
            }
        }
    }
}
 
Example #2
Source File: JmsInitialContextFactoryTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
@Test
public void testConnectionFactoryBindingWithInvalidFactorySpecificProperty() throws Exception {
    String factoryName = "myNewFactory";
    String uri = "amqp://example.com:1234";

    String propertyPrefix = JmsInitialContextFactory.CONNECTION_FACTORY_PROPERTY_KEY_PREFIX;

    Hashtable<Object, Object> env = new Hashtable<Object, Object>();
    env.put(JmsInitialContextFactory.CONNECTION_FACTORY_KEY_PREFIX + factoryName, uri);
    env.put(propertyPrefix + factoryName + "." + "invalidProperty", "value");

    try {
        createInitialContext(env);
        fail("Should have thrown exception");
    } catch (NamingException ne) {
        // Expected
        assertTrue("Should have had a cause", ne.getCause() != null);
    }
}
 
Example #3
Source File: PartialCompositeDirContext.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public DirContext createSubcontext(Name name, Attributes attrs)
        throws NamingException {
    PartialCompositeDirContext ctx = this;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);
    DirContext answer;
    Name nm = name;

    try {
        answer = ctx.p_createSubcontext(nm, attrs, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCDirContext(cont);
            answer = ctx.p_createSubcontext(nm, attrs, cont);
        }
    } catch (CannotProceedException e) {
        DirContext cctx = DirectoryManager.getContinuationDirContext(e);
        answer = cctx.createSubcontext(e.getRemainingName(), attrs);
    }
    return answer;
}
 
Example #4
Source File: PartialCompositeContext.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public Context createSubcontext(Name name) throws NamingException {
    PartialCompositeContext ctx = this;
    Name nm = name;
    Context answer;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);

    try {
        answer = ctx.p_createSubcontext(nm, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            answer = ctx.p_createSubcontext(nm, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        answer = cctx.createSubcontext(e.getRemainingName());
    }
    return answer;
}
 
Example #5
Source File: rmiURLContextFactory.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static Object getUsingURLs(String[] urls, Hashtable<?,?> env)
        throws NamingException
{
    if (urls.length == 0) {
        throw (new ConfigurationException(
                "rmiURLContextFactory: empty URL array"));
    }
    rmiURLContext urlCtx = new rmiURLContext(env);
    try {
        NamingException ne = null;
        for (int i = 0; i < urls.length; i++) {
            try {
                return urlCtx.lookup(urls[i]);
            } catch (NamingException e) {
                ne = e;
            }
        }
        throw ne;
    } finally {
        urlCtx.close();
    }
}
 
Example #6
Source File: ShowResponseTest.java    From sdl_java_suite with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
   * Tests a valid JSON construction of this RPC message.
   */
  public void testJsonConstructor () {
  	JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
  	assertNotNull(Test.NOT_NULL, commandJson);
  	
try {
	Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
	ShowResponse cmd = new ShowResponse(hash);
	
	JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
	assertNotNull(Test.NOT_NULL, body);
	
	// Test everything in the json body.
	assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
	assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
	e.printStackTrace();
}    	
  }
 
Example #7
Source File: SignatureFileVerifier.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * process the signature block file. Goes through the .SF file
 * and adds code signers for each section where the .SF section
 * hash was verified against the Manifest section.
 *
 *
 */
public void process(Hashtable<String, CodeSigner[]> signers,
        List<Object> manifestDigests)
    throws IOException, SignatureException, NoSuchAlgorithmException,
        JarException, CertificateException
{
    // calls Signature.getInstance() and MessageDigest.getInstance()
    // need to use local providers here, see Providers class
    Object obj = null;
    try {
        obj = Providers.startJarVerification();
        processImpl(signers, manifestDigests);
    } finally {
        Providers.stopJarVerification(obj);
    }

}
 
Example #8
Source File: IDLGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Write an IDL interface definition for a Java implementation class
 * @param t The current ImplementationType
 * @param p The output stream.
 */
protected void writeImplementation(
                                   ImplementationType t,
                                   IndentingWriter p )
    throws IOException {
    Hashtable inhHash = new Hashtable();
    Hashtable refHash = new Hashtable();
    getInterfaces( t,inhHash );                            //collect interfaces

    writeBanner( t,0,!isException,p );
    writeInheritedIncludes( inhHash,p );
    writeIfndef( t,0,!isException,!isForward,p );
    writeIncOrb( p );
    writeModule1( t,p );
    p.pln();p.pI();
    p.p( "interface " + t.getIDLName() );
    writeInherits( inhHash,!forValuetype,p );

    p.pln( " {" );
    p.pln( "};" );

    p.pO();p.pln();
    writeModule2( t,p );
    writeEpilog( t,refHash,p );
}
 
Example #9
Source File: MonitorServlet.java    From yawl with GNU Lesser General Public License v3.0 6 votes vote down vote up
/** Read settings from web.xml and use them to initialise the service */
public void init() {
    try {
        ServletContext context = getServletContext();

        // load the urls of the required interfaces
        Map<String, String> urlMap = new Hashtable<String, String>();
        String engineGateway = context.getInitParameter("EngineGateway");
        if (engineGateway != null) urlMap.put("engineGateway", engineGateway);
        String engineLogGateway = context.getInitParameter("EngineLogGateway");
        if (engineGateway != null) urlMap.put("engineLogGateway", engineLogGateway);
        String resourceGateway = context.getInitParameter("ResourceGateway");
        if (engineGateway != null) urlMap.put("resourceGateway", resourceGateway);
        String resourceLogGateway = context.getInitParameter("ResourceLogGateway");
        if (resourceLogGateway != null) urlMap.put("resourceLogGateway", resourceLogGateway);

        MonitorClient.getInstance().initInterfaces(urlMap); 
    }
    catch (Exception e) {
        LogManager.getLogger(this.getClass()).error("Monitor Service Initialisation Exception", e);
    }
}
 
Example #10
Source File: CardLayout.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes serializable fields to stream.
 */
private void writeObject(ObjectOutputStream s)
    throws IOException
{
    Hashtable<String, Component> tab = new Hashtable<>();
    int ncomponents = vector.size();
    for (int i = 0; i < ncomponents; i++) {
        Card card = (Card)vector.get(i);
        tab.put(card.name, card.comp);
    }

    ObjectOutputStream.PutField f = s.putFields();
    f.put("hgap", hgap);
    f.put("vgap", vgap);
    f.put("vector", vector);
    f.put("currentCard", currentCard);
    f.put("tab", tab);
    s.writeFields();
}
 
Example #11
Source File: SnmpRequestHandler.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Full constructor
 */
public SnmpRequestHandler(SnmpAdaptorServer server, int id,
                          DatagramSocket s, DatagramPacket p,
                          SnmpMibTree tree, Vector<SnmpMibAgent> m,
                          InetAddressAcl a,
                          SnmpPduFactory factory,
                          SnmpUserDataFactory dataFactory,
                          MBeanServer f, ObjectName n)
{
    super(server, id, f, n);

    // Need a reference on SnmpAdaptorServer for getNext & getBulk,
    // in case of oid equality (mib overlapping).
    //
    adaptor = server;
    socket = s;
    packet = p;
    root= tree;
    mibs = new Vector<>(m);
    subs= new Hashtable<>(mibs.size());
    ipacl = a;
    pduFactory = factory ;
    userDataFactory = dataFactory ;
    //thread.start();
}
 
Example #12
Source File: WhileStatement.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check a while statement
 */
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
    checkLabel(env, ctx);
    CheckContext newctx = new CheckContext(ctx, this);
    // remember what was unassigned on entry
    Vset vsEntry = vset.copy();
    // check the condition.  Determine which variables have values if
    // it returns true or false.
    ConditionVars cvars =
          cond.checkCondition(env, newctx, reach(env, vset), exp);
    cond = convert(env, newctx, Type.tBoolean, cond);
    // check the body, given that the condition returned true.
    vset = body.check(env, newctx, cvars.vsTrue, exp);
    vset = vset.join(newctx.vsContinue);
    // make sure the back-branch fits the entry of the loop
    ctx.checkBackBranch(env, this, vsEntry, vset);
    // Exit the while loop by testing false or getting a break statement
    vset = newctx.vsBreak.join(cvars.vsFalse);
    return ctx.removeAdditionalVars(vset);
}
 
Example #13
Source File: LdapProtocol.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public final void connect( String username, String password ) throws KettleException {
  Hashtable<String, String> env = new Hashtable<String, String>();
  setupEnvironment( env, username, password );
  try {
    /* Establish LDAP association */
    doConnect( username, password );

    if ( log.isBasic() ) {
      log.logBasic( BaseMessages.getString( PKG, "LDAPInput.Log.ConnectedToServer", hostname, Const.NVL(
        username, "" ) ) );
    }
    if ( log.isDetailed() ) {
      log.logDetailed( BaseMessages.getString( PKG, "LDAPInput.ClassUsed.Message", ctx.getClass().getName() ) );
    }

  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString( PKG, "LDAPinput.Exception.ErrorConnecting", e
      .getMessage() ), e );
  }
}
 
Example #14
Source File: NamingManager.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static Context getURLContext(
        String scheme, Hashtable<?,?> environment)
        throws NamingException {
    return new DnsContext("", null, new Hashtable<String,String>()) {
        public Attributes getAttributes(String name, String[] attrIds)
                throws NamingException {
            return new BasicAttributes() {
                public Attribute get(String attrID) {
                    BasicAttribute ba  = new BasicAttribute(attrID);
                    ba.add("1 1 99 b.com.");
                    ba.add("0 0 88 a.com.");    // 2nd has higher priority
                    return ba;
                }
            };
        }
    };
}
 
Example #15
Source File: ldapURLContextFactory.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
static ResolveResult getUsingURLIgnoreRootDN(String url, Hashtable<?,?> env)
        throws NamingException {
    LdapURL ldapUrl = new LdapURL(url);
    DirContext ctx = new LdapCtx("", ldapUrl.getHost(), ldapUrl.getPort(),
        env, ldapUrl.useSsl());
    String dn = (ldapUrl.getDN() != null ? ldapUrl.getDN() : "");

    // Represent DN as empty or single-component composite name.
    CompositeName remaining = new CompositeName();
    if (!"".equals(dn)) {
        // if nonempty, add component
        remaining.add(dn);
    }

    return new ResolveResult(ctx, remaining);
}
 
Example #16
Source File: ReadWriteProfileTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
static void getProfileTags(byte [] data, Hashtable tags) {
    ByteBuffer byteBuf = ByteBuffer.wrap(data);
    IntBuffer intBuf = byteBuf.asIntBuffer();
    int tagCount = intBuf.get(TAG_COUNT_OFFSET);
    intBuf.position(TAG_ELEM_OFFSET);
    for (int i = 0; i < tagCount; i++) {
        int tagSig = intBuf.get();
        int tagDataOff = intBuf.get();
        int tagSize = intBuf.get();

        byte [] tagData = new byte[tagSize];
        byteBuf.position(tagDataOff);
        byteBuf.get(tagData);
        tags.put(tagSig, tagData);
    }
}
 
Example #17
Source File: PartialCompositeDirContext.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public NamingEnumeration<SearchResult>
    search(Name name,
           String filter,
           SearchControls cons)
    throws NamingException
{

    PartialCompositeDirContext ctx = this;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);
    NamingEnumeration<SearchResult> answer;
    Name nm = name;

    try {
        answer = ctx.p_search(nm, filter, cons, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCDirContext(cont);
            answer = ctx.p_search(nm, filter, cons, cont);
        }
    } catch (CannotProceedException e) {
        DirContext cctx = DirectoryManager.getContinuationDirContext(e);
        answer = cctx.search(e.getRemainingName(), filter, cons);
    }
    return answer;
}
 
Example #18
Source File: DecodeThread.java    From react-native-smart-barcode with MIT License 5 votes vote down vote up
DecodeThread(CaptureView captureView,
               Vector<BarcodeFormat> decodeFormats,
               String characterSet,
               ResultPointCallback resultPointCallback) {
//    Log.i("Test", "DecodeThread create");
    this.captureView = captureView;
    handlerInitLatch = new CountDownLatch(1);//从1开始到计数

    hints = new Hashtable<DecodeHintType, Object>(3);

//    // The prefs can't change while the thread is running, so pick them up once here.
//    if (decodeFormats == null || decodeFormats.isEmpty()) {
//      SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
//      decodeFormats = new Vector<BarcodeFormat>();
//      if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_1D, true)) {
//        decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
//      }
//      if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_QR, true)) {
//        decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
//      }
//      if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_DATA_MATRIX, true)) {
//        decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
//      }
//    }
    if (decodeFormats == null || decodeFormats.isEmpty()) {
    	 decodeFormats = new Vector<BarcodeFormat>();
    	 decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
    	 decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
    	 decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
    	 
    }
    
    hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);

    if (characterSet != null) {
      hints.put(DecodeHintType.CHARACTER_SET, characterSet);
    }

    hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
  }
 
Example #19
Source File: HashtableTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * java.util.Hashtable#equals(java.lang.Object)
 */
public void test_equalsLjava_lang_Object() {
    // Test for method boolean java.util.Hashtable.equals(java.lang.Object)
    Hashtable h = hashtableClone(ht10);
    assertTrue("Returned false for equal tables", ht10.equals(h));
    assertTrue("Returned true for unequal tables", !ht10.equals(htfull));
}
 
Example #20
Source File: UIManager.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds the given theme properties on top of the existing properties without
 * clearing the existing theme first
 *
 * @param themeProps the properties of the given theme
 */
public void addThemeProps(Hashtable themeProps) {
    if (accessible) {
        buildTheme(themeProps);
        styles.clear();
        selectedStyles.clear();
        imageCache.clear();
        current.refreshTheme(false);
    }
}
 
Example #21
Source File: Defaults.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static Collection<Object[]> makeRWNoNullsMaps() {
    return Arrays.asList(
        // null key and value hostile
        new Object[]{"Hashtable", makeMap(Hashtable::new, false, false)},
        new Object[]{"ConcurrentHashMap", makeMap(ConcurrentHashMap::new, false, false)},
        new Object[]{"ConcurrentSkipListMap", makeMap(ConcurrentSkipListMap::new, false, false)},
        new Object[]{"Collections.synchronizedMap(ConcurrentHashMap)", Collections.synchronizedMap(makeMap(ConcurrentHashMap::new, false, false))},
        new Object[]{"Collections.checkedMap(ConcurrentHashMap)", Collections.checkedMap(makeMap(ConcurrentHashMap::new, false, false), IntegerEnum.class, String.class)},
        new Object[]{"ExtendsAbstractMap(ConcurrentHashMap)", makeMap(() -> {return new ExtendsAbstractMap(new ConcurrentHashMap());}, false, false)},
        new Object[]{"ImplementsConcurrentMap", makeMap(ImplementsConcurrentMap::new, false, false)}
        );
}
 
Example #22
Source File: MimeTypeParameterList.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
* @return a clone of this object
*/

public Object clone() {
    MimeTypeParameterList newObj = null;
    try {
        newObj = (MimeTypeParameterList)super.clone();
    } catch (CloneNotSupportedException cannotHappen) {
    }
    newObj.parameters = (Hashtable)parameters.clone();
    return newObj;
}
 
Example #23
Source File: JPopupMenuOperator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Hashtable<String, Object> getDump() {
    Hashtable<String, Object> result = super.getDump();
    if (((JPopupMenu) getSource()).getLabel() != null) {
        result.put(LABEL_DPROP, ((JPopupMenu) getSource()).getLabel());
    }
    return result;
}
 
Example #24
Source File: CryptoPermissions.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void writeObject(ObjectOutputStream s) throws IOException {
    Hashtable<String,PermissionCollection> permTable =
            new Hashtable<>(perms);
    ObjectOutputStream.PutField fields = s.putFields();
    fields.put("perms", permTable);
    s.writeFields();
}
 
Example #25
Source File: GetSetViewOfKeysFromHashtableExample.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
public static void main(String[] args) {

        //create Hashtable object
        Hashtable ht = new Hashtable();

        //add key value pairs to Hashtable
        ht.put("1", "One");
        ht.put("2", "Two");
        ht.put("3", "Three");

    /*
      get Set of keys contained in Hashtable using
      Set keySet() method of Hashtable class
    */

        Set st = ht.keySet();

        System.out.println("Set created from Hashtable Keys contains :");
        //iterate through the Set of keys
        Iterator itr = st.iterator();
        while (itr.hasNext()) System.out.println(itr.next());

    /*
       Please note that resultant Set object is backed by the Hashtable.
       Any key that is removed from Set will also be removed from
       original Hashtable object. The same is not the case with the element
       addition.
    */

        //remove 2 from Set
        st.remove("2");

        //print keys of original Hashtable
        System.out.println("Hashtable keys after removal from Set are :");
        Enumeration e = ht.keys();
        while (e.hasMoreElements()) System.out.println(e.nextElement());
    }
 
Example #26
Source File: MethodGen24.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <d62023> - write an abstract method definition
 **/
protected void abstractMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
{
  this.symbolTable = symbolTable;
  this.m           = m;
  this.stream      = stream;
  if (m.comment () != null)
    m.comment ().generate ("  ", stream);
  stream.print ("  ");
  stream.print ("public abstract ");
  writeMethodSignature ();
  stream.println (";");
  stream.println ();
}
 
Example #27
Source File: Main.java    From glitchify with MIT License 5 votes vote down vote up
private SpannableStringBuilder injectBadges(XC_MethodHook.MethodHookParam param, Class mediaSpanClass, SpannableStringBuilder chatMsg, Hashtable customBadges) {
    String chatSender = (String) callMethod(param.args[0], "getDisplayName");
    int location = chatMsg.toString().indexOf(chatSender);
    if (location == -1) { return chatMsg; }

    int badgeCount;
    if (location == 0) {
        badgeCount = location;
    } else {
        badgeCount = chatMsg.toString().substring(0, location - 1).split(" ").length;
    }

    for (Object key : customBadges.keySet()) {
        if (badgeCount >= 3) {
            // Already at 3 badges, anymore will clog up chat box
            return chatMsg;
        }
        String keyString = (String) key;
        if (preferences.hiddenBadges().contains(keyString)) {
            continue;
        }
        if (!((ArrayList) ((Hashtable) customBadges.get(keyString)).get("users")).contains(chatSender)) {
            continue;
        }
        String url = (String) ((Hashtable) customBadges.get(keyString)).get("image");
        SpannableString badgeSpan = (SpannableString) callMethod(param.thisObject, "a", param.thisObject, url, Enum.valueOf(mediaSpanClass, "Badge"), keyString + " ", null, true, 8, null);
        chatMsg.insert(location, badgeSpan);
        location += badgeSpan.length();
        badgeCount++;
    }
    return chatMsg;
}
 
Example #28
Source File: LdapCtx.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void ensureOpen(boolean startTLS) throws NamingException {

        try {
            if (clnt == null) {
                if (debug) {
                    System.err.println("LdapCtx: Reconnecting " + this);
                }

                // reset the cache before a new connection is established
                schemaTrees = new Hashtable<>(11, 0.75f);
                connect(startTLS);

            } else if (!sharable || startTLS) {

                synchronized (clnt) {
                    if (!clnt.isLdapv3
                        || clnt.referenceCount > 1
                        || clnt.usingSaslStreams()) {
                        closeConnection(SOFT_CLOSE);
                    }
                }
                // reset the cache before a new connection is established
                schemaTrees = new Hashtable<>(11, 0.75f);
                connect(startTLS);
            }

        } finally {
            sharable = true;   // connection is now either new or single-use
                               // OK for others to start sharing again
        }
    }
 
Example #29
Source File: ConfigurationUtils.java    From iaf with Apache License 2.0 5 votes vote down vote up
public static String getStubbedConfiguration(Configuration configuration, String originalConfig) throws ConfigurationException {
	Map<String, Object> parameters = new Hashtable<String, Object>();
	// Parameter disableValidators has been used to test the impact of
	// validators on memory usage.
	parameters.put("disableValidators", AppConstants.getInstance(configuration.getClassLoader()).getBoolean(STUB4TESTTOOL_VALIDATORS_DISABLED_KEY, false));
	return transformConfiguration(configuration, originalConfig, STUB4TESTTOOL_XSLT, parameters);
}
 
Example #30
Source File: LdapClient.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private boolean isBinaryValued(String attrid,
                               Hashtable<String, Boolean> binaryAttrs) {
    String id = attrid.toLowerCase(Locale.ENGLISH);

    return ((id.indexOf(";binary") != -1) ||
        defaultBinaryAttrs.containsKey(id) ||
        ((binaryAttrs != null) && (binaryAttrs.containsKey(id))));
}