Java Code Examples for java.rmi.server.UID

The following are top voted examples for showing how to use java.rmi.server.UID. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: APacheSynapseSimplePOC   File: JRMPListener.java   Source Code and License 6 votes vote down vote up
private void doMessage ( Socket s, DataInputStream in, DataOutputStream out, Object payload ) throws Exception {
    System.err.println("Reading message...");

    int op = in.read();

    switch ( op ) {
    case TransportConstants.Call:
        // service incoming RMI call
        doCall(in, out, payload);
        break;

    case TransportConstants.Ping:
        // send ack for ping
        out.writeByte(TransportConstants.PingAck);
        break;

    case TransportConstants.DGCAck:
        UID u = UID.read(in);
        break;

    default:
        throw new IOException("unknown transport op " + op);
    }

    s.close();
}
 
Example 2
Project: the-vigilantes   File: MysqlSavepoint.java   Source Code and License 6 votes vote down vote up
private static String getUniqueId() {
    // no need to re-invent the wheel here...
    String uidStr = new UID().toString();

    int uidLength = uidStr.length();

    StringBuilder safeString = new StringBuilder(uidLength + 1);
    safeString.append('_');

    for (int i = 0; i < uidLength; i++) {
        char c = uidStr.charAt(i);

        if (Character.isLetter(c) || Character.isDigit(c)) {
            safeString.append(c);
        } else {
            safeString.append('_');
        }
    }

    return safeString.toString();
}
 
Example 3
Project: OpenVertretung   File: MysqlSavepoint.java   Source Code and License 6 votes vote down vote up
private static String getUniqueId() {
    // no need to re-invent the wheel here...
    String uidStr = new UID().toString();

    int uidLength = uidStr.length();

    StringBuilder safeString = new StringBuilder(uidLength + 1);
    safeString.append('_');

    for (int i = 0; i < uidLength; i++) {
        char c = uidStr.charAt(i);

        if (Character.isLetter(c) || Character.isDigit(c)) {
            safeString.append(c);
        } else {
            safeString.append('_');
        }
    }

    return safeString.toString();
}
 
Example 4
Project: lams   File: MysqlSavepoint.java   Source Code and License 6 votes vote down vote up
private static String getUniqueId() {
    // no need to re-invent the wheel here...
    String uidStr = new UID().toString();

    int uidLength = uidStr.length();

    StringBuilder safeString = new StringBuilder(uidLength + 1);
    safeString.append('_');

    for (int i = 0; i < uidLength; i++) {
        char c = uidStr.charAt(i);

        if (Character.isLetter(c) || Character.isDigit(c)) {
            safeString.append(c);
        } else {
            safeString.append('_');
        }
    }

    return safeString.toString();
}
 
Example 5
Project: ProyectoPacientes   File: MysqlSavepoint.java   Source Code and License 6 votes vote down vote up
private static String getUniqueId() {
    // no need to re-invent the wheel here...
    String uidStr = new UID().toString();

    int uidLength = uidStr.length();

    StringBuilder safeString = new StringBuilder(uidLength + 1);
    safeString.append('_');

    for (int i = 0; i < uidLength; i++) {
        char c = uidStr.charAt(i);

        if (Character.isLetter(c) || Character.isDigit(c)) {
            safeString.append(c);
        } else {
            safeString.append('_');
        }
    }

    return safeString.toString();
}
 
Example 6
Project: ysoserial-modified   File: JRMPListener.java   Source Code and License 6 votes vote down vote up
private void doMessage ( Socket s, DataInputStream in, DataOutputStream out, Object payload ) throws Exception {
    System.err.println("Reading message...");

    int op = in.read();

    switch ( op ) {
    case TransportConstants.Call:
        // service incoming RMI call
        doCall(in, out, payload);
        break;

    case TransportConstants.Ping:
        // send ack for ping
        out.writeByte(TransportConstants.PingAck);
        break;

    case TransportConstants.DGCAck:
        UID u = UID.read(in);
        break;

    default:
        throw new IOException("unknown transport op " + op);
    }

    s.close();
}
 
Example 7
Project: marshalsec   File: RMIRefServer.java   Source Code and License 6 votes vote down vote up
private void doMessage ( Socket s, DataInputStream in, DataOutputStream out ) throws Exception {
    System.err.println("Reading message...");

    int op = in.read();

    switch ( op ) {
    case TransportConstants.Call:
        // service incoming RMI call
        doCall(in, out);
        break;

    case TransportConstants.Ping:
        // send ack for ping
        out.writeByte(TransportConstants.PingAck);
        break;

    case TransportConstants.DGCAck:
        UID.read(in);
        break;

    default:
        throw new IOException("unknown transport op " + op);
    }

    s.close();
}
 
Example 8
Project: BibliotecaPS   File: MysqlSavepoint.java   Source Code and License 6 votes vote down vote up
private static String getUniqueId() {
    // no need to re-invent the wheel here...
    String uidStr = new UID().toString();

    int uidLength = uidStr.length();

    StringBuilder safeString = new StringBuilder(uidLength + 1);
    safeString.append('_');

    for (int i = 0; i < uidLength; i++) {
        char c = uidStr.charAt(i);

        if (Character.isLetter(c) || Character.isDigit(c)) {
            safeString.append(c);
        } else {
            safeString.append('_');
        }
    }

    return safeString.toString();
}
 
Example 9
Project: ysoserial-plus   File: JRMPListener.java   Source Code and License 6 votes vote down vote up
private void doMessage ( Socket s, DataInputStream in, DataOutputStream out, Object payload ) throws Exception {
    System.err.println("Reading message...");

    int op = in.read();

    switch ( op ) {
    case TransportConstants.Call:
        // service incoming RMI call
        doCall(in, out, payload);
        break;

    case TransportConstants.Ping:
        // send ack for ping
        out.writeByte(TransportConstants.PingAck);
        break;

    case TransportConstants.DGCAck:
        UID u = UID.read(in);
        break;

    default:
        throw new IOException("unknown transport op " + op);
    }

    s.close();
}
 
Example 10
Project: Geometry-wars   File: XATest.java   Source Code and License 6 votes vote down vote up
private Xid createXid() throws IOException {
    ByteArrayOutputStream gtridOut = new ByteArrayOutputStream();
    DataOutputStream dataOut = new DataOutputStream(gtridOut);
    new UID().write(dataOut);

    final byte[] gtrid = gtridOut.toByteArray();

    ByteArrayOutputStream bqualOut = new ByteArrayOutputStream();
    dataOut = new DataOutputStream(bqualOut);

    new UID().write(dataOut);

    final byte[] bqual = bqualOut.toByteArray();

    Xid xid = new MysqlXid(gtrid, bqual, 3306);
    return xid;
}
 
Example 11
Project: Geometry-wars   File: MysqlSavepoint.java   Source Code and License 6 votes vote down vote up
private static String getUniqueId() {
    // no need to re-invent the wheel here...
    String uidStr = new UID().toString();

    int uidLength = uidStr.length();

    StringBuilder safeString = new StringBuilder(uidLength + 1);
    safeString.append('_');

    for (int i = 0; i < uidLength; i++) {
        char c = uidStr.charAt(i);

        if (Character.isLetter(c) || Character.isDigit(c)) {
            safeString.append(c);
        } else {
            safeString.append('_');
        }
    }

    return safeString.toString();
}
 
Example 12
Project: TPKB   File: XATest.java   Source Code and License 6 votes vote down vote up
private Xid createXid() throws IOException {
    ByteArrayOutputStream gtridOut = new ByteArrayOutputStream();
    DataOutputStream dataOut = new DataOutputStream(gtridOut);
    new UID().write(dataOut);

    final byte[] gtrid = gtridOut.toByteArray();

    ByteArrayOutputStream bqualOut = new ByteArrayOutputStream();
    dataOut = new DataOutputStream(bqualOut);

    new UID().write(dataOut);

    final byte[] bqual = bqualOut.toByteArray();

    Xid xid = new MysqlXid(gtrid, bqual, 3306);
    return xid;
}
 
Example 13
Project: TPKB   File: MysqlSavepoint.java   Source Code and License 6 votes vote down vote up
private static String getUniqueId() {
    // no need to re-invent the wheel here...
    String uidStr = new UID().toString();

    int uidLength = uidStr.length();

    StringBuilder safeString = new StringBuilder(uidLength + 1);
    safeString.append('_');

    for (int i = 0; i < uidLength; i++) {
        char c = uidStr.charAt(i);

        if (Character.isLetter(c) || Character.isDigit(c)) {
            safeString.append(c);
        } else {
            safeString.append('_');
        }
    }

    return safeString.toString();
}
 
Example 14
Project: cloudera-cli-scripts   File: XATest.java   Source Code and License 6 votes vote down vote up
private Xid createXid() throws IOException {
    ByteArrayOutputStream gtridOut = new ByteArrayOutputStream();
    DataOutputStream dataOut = new DataOutputStream(gtridOut);
    new UID().write(dataOut);

    final byte[] gtrid = gtridOut.toByteArray();

    ByteArrayOutputStream bqualOut = new ByteArrayOutputStream();
    dataOut = new DataOutputStream(bqualOut);

    new UID().write(dataOut);

    final byte[] bqual = bqualOut.toByteArray();

    Xid xid = new MysqlXid(gtrid, bqual, 3306);
    return xid;
}
 
Example 15
Project: cloudera-cli-scripts   File: MysqlSavepoint.java   Source Code and License 6 votes vote down vote up
private static String getUniqueId() {
    // no need to re-invent the wheel here...
    String uidStr = new UID().toString();

    int uidLength = uidStr.length();

    StringBuilder safeString = new StringBuilder(uidLength + 1);
    safeString.append('_');

    for (int i = 0; i < uidLength; i++) {
        char c = uidStr.charAt(i);

        if (Character.isLetter(c) || Character.isDigit(c)) {
            safeString.append(c);
        } else {
            safeString.append('_');
        }
    }

    return safeString.toString();
}
 
Example 16
Project: fil_project_mgmt_app_v2   File: XATest.java   Source Code and License 6 votes vote down vote up
private Xid createXid() throws IOException {
	ByteArrayOutputStream gtridOut = new ByteArrayOutputStream();
	DataOutputStream dataOut = new DataOutputStream(gtridOut);
	new UID().write(dataOut);
	
	final byte[] gtrid = gtridOut.toByteArray();
	
	ByteArrayOutputStream bqualOut = new ByteArrayOutputStream();
	dataOut = new DataOutputStream(bqualOut);
	
	new UID().write(dataOut);
	
	final byte[] bqual = bqualOut.toByteArray();
	
	Xid xid = new MysqlXid(gtrid, bqual, 3306);
	return xid;
}
 
Example 17
Project: fil_project_mgmt_app_v2   File: MysqlSavepoint.java   Source Code and License 6 votes vote down vote up
private static String getUniqueId() {
	// no need to re-invent the wheel here...
	String uidStr = new UID().toString();

	int uidLength = uidStr.length();

	StringBuffer safeString = new StringBuffer(uidLength+1);
	safeString.append('_');

	for (int i = 0; i < uidLength; i++) {
		char c = uidStr.charAt(i);

		if (Character.isLetter(c) || Character.isDigit(c)) {
			safeString.append(c);
		} else {
			safeString.append('_');
		}
	}

	return safeString.toString();
}
 
Example 18
Project: ysoserial   File: JRMPListener.java   Source Code and License 6 votes vote down vote up
private void doMessage ( Socket s, DataInputStream in, DataOutputStream out, Object payload ) throws Exception {
    System.err.println("Reading message...");

    int op = in.read();

    switch ( op ) {
    case TransportConstants.Call:
        // service incoming RMI call
        doCall(in, out, payload);
        break;

    case TransportConstants.Ping:
        // send ack for ping
        out.writeByte(TransportConstants.PingAck);
        break;

    case TransportConstants.DGCAck:
        UID u = UID.read(in);
        break;

    default:
        throw new IOException("unknown transport op " + op);
    }

    s.close();
}
 
Example 19
Project: indoor-tracking   File: MysqlSavepoint.java   Source Code and License 6 votes vote down vote up
private static String getUniqueId() {
	// no need to re-invent the wheel here...
	String uidStr = new UID().toString();

	int uidLength = uidStr.length();

	StringBuffer safeString = new StringBuffer(uidLength+1);
	safeString.append('_');

	for (int i = 0; i < uidLength; i++) {
		char c = uidStr.charAt(i);

		if (Character.isLetter(c) || Character.isDigit(c)) {
			safeString.append(c);
		} else {
			safeString.append('_');
		}
	}

	return safeString.toString();
}
 
Example 20
Project: eterna   File: DataBaseLocker.java   Source Code and License 6 votes vote down vote up
private static String getRuntimeName0()
{
	String name = null;
	String address = "localhost";
	try
	{
		address = InetAddress.getLocalHost().getHostAddress();
		Class c = Class.forName("java.lang.management.ManagementFactory");
		Method m = c.getMethod("getRuntimeMXBean", new Class[0]);
		Object runtime = m.invoke(null, new Object[0]);
		c = Class.forName("java.lang.management.RuntimeMXBean");
		m = c.getMethod("getName", new Class[0]);
		name = String.valueOf(m.invoke(runtime, new Object[0]));
		name += "@" + address;
	}
	catch (Throwable ex)
	{
		name = (new UID()) + "@" + address;
	}
	return name;
}
 
Example 21
Project: cn1   File: ClientConnection.java   Source Code and License 6 votes vote down vote up
/**
 * Opens a connection to the given Endpoint and writes DGC ack there.
 *
 * @param uid UID to be send
 */
public void sendDGCAck(UID uid) {
    ClientConnection conn = null;

    try {
        conn = ClientConnectionManager.getConnection(ep);
        DataOutputStream dout = new DataOutputStream(out);
        dout.writeByte(RMIProtocolConstants.DGCACK_MSG);
        uid.write(dout);
        dout.flush();
        conn.releaseOutputStream();
        conn.done();
    } catch (IOException ioe) {
        if (conn != null) {
            conn.close();
        }
    }

    if (dgcLog.isLoggable(RMILog.VERBOSE)) {
        // rmi.log.93=Sent DGC ack to {0} for {1}
        dgcLog.log(RMILog.VERBOSE, Messages.getString("rmi.log.93", ep, uid)); //$NON-NLS-1$
    }
}
 
Example 22
Project: uDig-SOS-plugin   File: SOSFeature.java   Source Code and License 6 votes vote down vote up
/**
 * Creates an ID from a hashcode.
 * 
 * @return an id for the feature.
 */
String defaultID() {
	// According to GML and XML schema standards, FID is a XML ID
	// (http://www.w3.org/TR/xmlschema-2/#ID), whose acceptable values are
	// those that match an
	// NCNAME production
	// (http://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName):
	// NCName ::= (Letter | '_') (NCNameChar)* /* An XML Name, minus the ":"
	// */
	// NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar |
	// Extender
	// We have to fix the generated UID replacing all non word chars with an
	// _ (it seems
	// they area all ":")
	return "fid-" + new UID().toString().replaceAll("\\W", "_");
}
 
Example 23
Project: SMPT42   File: XATest.java   Source Code and License 6 votes vote down vote up
private Xid createXid() throws IOException {
    ByteArrayOutputStream gtridOut = new ByteArrayOutputStream();
    DataOutputStream dataOut = new DataOutputStream(gtridOut);
    new UID().write(dataOut);

    final byte[] gtrid = gtridOut.toByteArray();

    ByteArrayOutputStream bqualOut = new ByteArrayOutputStream();
    dataOut = new DataOutputStream(bqualOut);

    new UID().write(dataOut);

    final byte[] bqual = bqualOut.toByteArray();

    Xid xid = new MysqlXid(gtrid, bqual, 3306);
    return xid;
}
 
Example 24
Project: SMPT42   File: MysqlSavepoint.java   Source Code and License 6 votes vote down vote up
private static String getUniqueId() {
    // no need to re-invent the wheel here...
    String uidStr = new UID().toString();

    int uidLength = uidStr.length();

    StringBuffer safeString = new StringBuffer(uidLength + 1);
    safeString.append('_');

    for (int i = 0; i < uidLength; i++) {
        char c = uidStr.charAt(i);

        if (Character.isLetter(c) || Character.isDigit(c)) {
            safeString.append(c);
        } else {
            safeString.append('_');
        }
    }

    return safeString.toString();
}
 
Example 25
Project: ForYou   File: XATest.java   Source Code and License 6 votes vote down vote up
private Xid createXid() throws IOException {
	ByteArrayOutputStream gtridOut = new ByteArrayOutputStream();
	DataOutputStream dataOut = new DataOutputStream(gtridOut);
	new UID().write(dataOut);
	
	final byte[] gtrid = gtridOut.toByteArray();
	
	ByteArrayOutputStream bqualOut = new ByteArrayOutputStream();
	dataOut = new DataOutputStream(bqualOut);
	
	new UID().write(dataOut);
	
	final byte[] bqual = bqualOut.toByteArray();
	
	Xid xid = new MysqlXid(gtrid, bqual, 3306);
	return xid;
}
 
Example 26
Project: ForYou   File: MysqlSavepoint.java   Source Code and License 6 votes vote down vote up
private static String getUniqueId() {
	// no need to re-invent the wheel here...
	String uidStr = new UID().toString();

	int uidLength = uidStr.length();

	StringBuffer safeString = new StringBuffer(uidLength+1);
	safeString.append('_');

	for (int i = 0; i < uidLength; i++) {
		char c = uidStr.charAt(i);

		if (Character.isLetter(c) || Character.isDigit(c)) {
			safeString.append(c);
		} else {
			safeString.append('_');
		}
	}

	return safeString.toString();
}
 
Example 27
Project: group-five   File: XATest.java   Source Code and License 6 votes vote down vote up
private Xid createXid() throws IOException {
    ByteArrayOutputStream gtridOut = new ByteArrayOutputStream();
    DataOutputStream dataOut = new DataOutputStream(gtridOut);
    new UID().write(dataOut);

    final byte[] gtrid = gtridOut.toByteArray();

    ByteArrayOutputStream bqualOut = new ByteArrayOutputStream();
    dataOut = new DataOutputStream(bqualOut);

    new UID().write(dataOut);

    final byte[] bqual = bqualOut.toByteArray();

    Xid xid = new MysqlXid(gtrid, bqual, 3306);
    return xid;
}
 
Example 28
Project: group-five   File: MysqlSavepoint.java   Source Code and License 6 votes vote down vote up
private static String getUniqueId() {
    // no need to re-invent the wheel here...
    String uidStr = new UID().toString();

    int uidLength = uidStr.length();

    StringBuffer safeString = new StringBuffer(uidLength + 1);
    safeString.append('_');

    for (int i = 0; i < uidLength; i++) {
        char c = uidStr.charAt(i);

        if (Character.isLetter(c) || Character.isDigit(c)) {
            safeString.append(c);
        } else {
            safeString.append('_');
        }
    }

    return safeString.toString();
}
 
Example 29
Project: locaviewer   File: XATest.java   Source Code and License 6 votes vote down vote up
private Xid createXid() throws IOException {
    ByteArrayOutputStream gtridOut = new ByteArrayOutputStream();
    DataOutputStream dataOut = new DataOutputStream(gtridOut);
    new UID().write(dataOut);

    final byte[] gtrid = gtridOut.toByteArray();

    ByteArrayOutputStream bqualOut = new ByteArrayOutputStream();
    dataOut = new DataOutputStream(bqualOut);

    new UID().write(dataOut);

    final byte[] bqual = bqualOut.toByteArray();

    Xid xid = new MysqlXid(gtrid, bqual, 3306);
    return xid;
}
 
Example 30
Project: locaviewer   File: MysqlSavepoint.java   Source Code and License 6 votes vote down vote up
private static String getUniqueId() {
    // no need to re-invent the wheel here...
    String uidStr = new UID().toString();

    int uidLength = uidStr.length();

    StringBuffer safeString = new StringBuffer(uidLength + 1);
    safeString.append('_');

    for (int i = 0; i < uidLength; i++) {
        char c = uidStr.charAt(i);

        if (Character.isLetter(c) || Character.isDigit(c)) {
            safeString.append(c);
        } else {
            safeString.append('_');
        }
    }

    return safeString.toString();
}
 
Example 31
Project: locaviewer   File: XATest.java   Source Code and License 6 votes vote down vote up
private Xid createXid() throws IOException {
    ByteArrayOutputStream gtridOut = new ByteArrayOutputStream();
    DataOutputStream dataOut = new DataOutputStream(gtridOut);
    new UID().write(dataOut);

    final byte[] gtrid = gtridOut.toByteArray();

    ByteArrayOutputStream bqualOut = new ByteArrayOutputStream();
    dataOut = new DataOutputStream(bqualOut);

    new UID().write(dataOut);

    final byte[] bqual = bqualOut.toByteArray();

    Xid xid = new MysqlXid(gtrid, bqual, 3306);
    return xid;
}
 
Example 32
Project: locaviewer   File: MysqlSavepoint.java   Source Code and License 6 votes vote down vote up
private static String getUniqueId() {
    // no need to re-invent the wheel here...
    String uidStr = new UID().toString();

    int uidLength = uidStr.length();

    StringBuffer safeString = new StringBuffer(uidLength + 1);
    safeString.append('_');

    for (int i = 0; i < uidLength; i++) {
        char c = uidStr.charAt(i);

        if (Character.isLetter(c) || Character.isDigit(c)) {
            safeString.append(c);
        } else {
            safeString.append('_');
        }
    }

    return safeString.toString();
}
 
Example 33
Project: manydesigns.cn   File: MysqlSavepoint.java   Source Code and License 6 votes vote down vote up
private static String getUniqueId() {
	// no need to re-invent the wheel here...
	String uidStr = new UID().toString();

	int uidLength = uidStr.length();

	StringBuffer safeString = new StringBuffer(uidLength+1);
	safeString.append('_');

	for (int i = 0; i < uidLength; i++) {
		char c = uidStr.charAt(i);

		if (Character.isLetter(c) || Character.isDigit(c)) {
			safeString.append(c);
		} else {
			safeString.append('_');
		}
	}

	return safeString.toString();
}
 
Example 34
Project: Gladiatus   File: XATest.java   Source Code and License 6 votes vote down vote up
private Xid createXid() throws IOException {
	ByteArrayOutputStream gtridOut = new ByteArrayOutputStream();
	DataOutputStream dataOut = new DataOutputStream(gtridOut);
	new UID().write(dataOut);
	
	final byte[] gtrid = gtridOut.toByteArray();
	
	ByteArrayOutputStream bqualOut = new ByteArrayOutputStream();
	dataOut = new DataOutputStream(bqualOut);
	
	new UID().write(dataOut);
	
	final byte[] bqual = bqualOut.toByteArray();
	
	Xid xid = new MysqlXid(gtrid, bqual, 3306);
	return xid;
}
 
Example 35
Project: Gladiatus   File: MysqlSavepoint.java   Source Code and License 6 votes vote down vote up
private static String getUniqueId() {
	// no need to re-invent the wheel here...
	String uidStr = new UID().toString();

	int uidLength = uidStr.length();

	StringBuffer safeString = new StringBuffer(uidLength+1);
	safeString.append('_');

	for (int i = 0; i < uidLength; i++) {
		char c = uidStr.charAt(i);

		if (Character.isLetter(c) || Character.isDigit(c)) {
			safeString.append(c);
		} else {
			safeString.append('_');
		}
	}

	return safeString.toString();
}
 
Example 36
Project: Jspad   File: XATest.java   Source Code and License 6 votes vote down vote up
private Xid createXid() throws IOException {
	ByteArrayOutputStream gtridOut = new ByteArrayOutputStream();
	DataOutputStream dataOut = new DataOutputStream(gtridOut);
	new UID().write(dataOut);
	
	final byte[] gtrid = gtridOut.toByteArray();
	
	ByteArrayOutputStream bqualOut = new ByteArrayOutputStream();
	dataOut = new DataOutputStream(bqualOut);
	
	new UID().write(dataOut);
	
	final byte[] bqual = bqualOut.toByteArray();
	
	Xid xid = new MysqlXid(gtrid, bqual, 3306);
	return xid;
}
 
Example 37
Project: Jspad   File: MysqlSavepoint.java   Source Code and License 6 votes vote down vote up
private static String getUniqueId() {
	// no need to re-invent the wheel here...
	String uidStr = new UID().toString();

	int uidLength = uidStr.length();

	StringBuffer safeString = new StringBuffer(uidLength+1);
	safeString.append('_');

	for (int i = 0; i < uidLength; i++) {
		char c = uidStr.charAt(i);

		if (Character.isLetter(c) || Character.isDigit(c)) {
			safeString.append(c);
		} else {
			safeString.append('_');
		}
	}

	return safeString.toString();
}
 
Example 38
Project: olfs   File: MultipartResponse.java   Source Code and License 6 votes vote down vote up
/**
 * @return Returns a new UID String
 */
public static String newUidString() {
    UID uid = new UID();

    byte[] val = uid.toString().getBytes();

    String suid = "";
    int v;

    for (byte aVal : val) {
        v = aVal;
        suid += Integer.toHexString(v);
    }

    return suid;
}
 
Example 39
Project: olfs   File: MimeBoundary.java   Source Code and License 6 votes vote down vote up
/**
 *
 * @return Returns a new UID String
 */
public static String newUidString(){
    UID uid = new UID();

    byte[] val = uid.toString().getBytes(HyraxStringEncoding.getCharset());

    StringBuilder suid  = new StringBuilder();
    int v;

    for (byte aVal : val) {
        v = aVal;
        suid.append(Integer.toHexString(v));
    }

    return suid.toString();
}
 
Example 40
Project: freeVM   File: AbstractServerConnection.java   Source Code and License 6 votes vote down vote up
/**
 * It does periodic cleanups in the {@link #dgcAckWaitingMap}, to
 * free the memory that could be still allocated due to lost dgcAcks
 */
protected void doDgcAckWaitingMapCleanUp() {
	long time = System.currentTimeMillis();
	synchronized (dgcAckWaitingMap) {
		if (time > dgcAckMapNextCleanup) {
			Iterator<Map.Entry<UID, Pair<Long, Object>>> iter = dgcAckWaitingMap
					.entrySet().iterator();
			while (iter.hasNext()) {
				Map.Entry<UID, Pair<Long, Object>> mapEntry = iter.next();
				if (time > mapEntry.getValue().getFirst()) {
					iter.remove();
				}
			}
			dgcAckMapNextCleanup = time + dgcAckMapTimeOut;
		}
	}
}