• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UUIDGenerator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.catalina.tribes.util.UUIDGenerator的典型用法代码示例。如果您正苦于以下问题:Java UUIDGenerator类的具体用法?Java UUIDGenerator怎么用?Java UUIDGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UUIDGenerator类属于org.apache.catalina.tribes.util包,在下文中一共展示了UUIDGenerator类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setLocalMemberProperties

import org.apache.catalina.tribes.util.UUIDGenerator; //导入依赖的package包/类
/**
 * Sets the local member properties for broadcasting
 */
@Override
public void setLocalMemberProperties(String listenHost, int listenPort, int securePort, int udpPort) {
    properties.setProperty("tcpListenHost",listenHost);
    properties.setProperty("tcpListenPort",String.valueOf(listenPort));
    properties.setProperty("udpListenPort",String.valueOf(udpPort));
    properties.setProperty("tcpSecurePort",String.valueOf(securePort));
    try {
        if (localMember != null) {
            localMember.setHostname(listenHost);
            localMember.setPort(listenPort);
        } else {
            localMember = new MemberImpl(listenHost, listenPort, 0);
            localMember.setUniqueId(UUIDGenerator.randomUUID(true));
            localMember.setPayload(getPayload());
            localMember.setDomain(getDomain());
            localMember.setLocal(true);
        }
        localMember.setSecurePort(securePort);
        localMember.setUdpPort(udpPort);
        localMember.getData(true, true);
    }catch ( IOException x ) {
        throw new IllegalArgumentException(x);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:28,代码来源:McastService.java


示例2: main

import org.apache.catalina.tribes.util.UUIDGenerator; //导入依赖的package包/类
@SuppressWarnings("unused")
public static void main(String[] args) throws Exception {
    if (args.length==0) usage();
    main = Thread.currentThread();
    ManagedChannel channel = (ManagedChannel) ChannelCreator.createChannel(args);
    Properties props = new Properties();
    props.setProperty("mydomainkey","mydomainvalue");
    props.setProperty("someotherkey", Arrays.toString(UUIDGenerator.randomUUID(true)));
    new MembersWithProperties(channel, props);
    channel.start(Channel.DEFAULT);
    Runtime.getRuntime().addShutdownHook(new Shutdown(channel));
    try {
        Thread.sleep(Long.MAX_VALUE);
    }catch(InterruptedException ix) {
        Thread.sleep(5000);//allow everything to shutdown
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:18,代码来源:MembersWithProperties.java


示例3: setLocalMemberProperties

import org.apache.catalina.tribes.util.UUIDGenerator; //导入依赖的package包/类
/**
 * Sets the local member properties for broadcasting
 */
@Override
public void setLocalMemberProperties(String listenHost, int listenPort, int securePort, int udpPort) {
	properties.setProperty("tcpListenHost", listenHost);
	properties.setProperty("tcpListenPort", String.valueOf(listenPort));
	properties.setProperty("udpListenPort", String.valueOf(udpPort));
	properties.setProperty("tcpSecurePort", String.valueOf(securePort));
	try {
		if (localMember != null) {
			localMember.setHostname(listenHost);
			localMember.setPort(listenPort);
		} else {
			localMember = new MemberImpl(listenHost, listenPort, 0);
			localMember.setUniqueId(UUIDGenerator.randomUUID(true));
			localMember.setPayload(getPayload());
			localMember.setDomain(getDomain());
			localMember.setLocal(true);
		}
		localMember.setSecurePort(securePort);
		localMember.setUdpPort(udpPort);
		localMember.getData(true, true);
	} catch (IOException x) {
		throw new IllegalArgumentException(x);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:28,代码来源:McastService.java


示例4: sendMessage

import org.apache.catalina.tribes.util.UUIDGenerator; //导入依赖的package包/类
@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws
    ChannelException {
    //todo, optimize, if destination.length==1, then we can do
    //msg.setOptions(msg.getOptions() & (~getOptionFlag())
    //and just send one message
    if (okToProcess(msg.getOptions()) ) {
        super.sendMessage(destination, msg, null);
        ChannelMessage confirmation = null;
        if ( deepclone ) confirmation = (ChannelMessage)msg.deepclone();
        else confirmation = (ChannelMessage)msg.clone();
        confirmation.getMessage().reset();
        UUIDGenerator.randomUUID(false,confirmation.getUniqueId(),0);
        confirmation.getMessage().append(START_DATA,0,START_DATA.length);
        confirmation.getMessage().append(msg.getUniqueId(),0,msg.getUniqueId().length);
        confirmation.getMessage().append(END_DATA,0,END_DATA.length);
        super.sendMessage(destination,confirmation,payload);
    } else {
        //turn off two phase commit
        //this wont work if the interceptor has 0 as a flag
        //since there is no flag to turn off
        //msg.setOptions(msg.getOptions() & (~getOptionFlag()));
        super.sendMessage(destination, msg, payload);
    }
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:26,代码来源:TwoPhaseCommitInterceptor.java


示例5: setLocalMemberProperties

import org.apache.catalina.tribes.util.UUIDGenerator; //导入依赖的package包/类
/**
 * Sets the local member properties for broadcasting
 */
@Override
public void setLocalMemberProperties(String listenHost, int listenPort, int securePort, int udpPort) {
    properties.setProperty("tcpListenHost",listenHost);
    properties.setProperty("tcpListenPort",String.valueOf(listenPort));
    properties.setProperty("udpListenPort",String.valueOf(udpPort));
    properties.setProperty("tcpSecurePort",String.valueOf(securePort));
    try {
        if (localMember != null) {
            localMember.setHostname(listenHost);
            localMember.setPort(listenPort);
        } else {
            localMember = new MemberImpl(listenHost, listenPort, 0);
            localMember.setUniqueId(UUIDGenerator.randomUUID(true));
            localMember.setPayload(getPayload());
            localMember.setDomain(getDomain());
        }
        localMember.setSecurePort(securePort);
        localMember.setUdpPort(udpPort);
        localMember.getData(true, true);
    }catch ( IOException x ) {
        throw new IllegalArgumentException(x);
    }
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:27,代码来源:McastService.java


示例6: send

import org.apache.catalina.tribes.util.UUIDGenerator; //导入依赖的package包/类
/**
 * Send a message and wait for the response.
 * @param destination Member[] - the destination for the message, and the members you request a reply from
 * @param message Serializable - the message you are sending out
 * @param rpcOptions int - FIRST_REPLY, MAJORITY_REPLY or ALL_REPLY
 * @param channelOptions channel sender options
 * @param timeout long - timeout in milliseconds, if no reply is received within this time null is returned
 * @return Response[] - an array of response objects.
 * @throws ChannelException
 */
public Response[] send(Member[] destination, 
                       Serializable message,
                       int rpcOptions, 
                       int channelOptions,
                       long timeout) throws ChannelException {
    
    if ( destination==null || destination.length == 0 ) return new Response[0];
    
    //avoid dead lock
    int sendOptions =
        channelOptions & ~Channel.SEND_OPTIONS_SYNCHRONIZED_ACK;
    
    RpcCollectorKey key = new RpcCollectorKey(UUIDGenerator.randomUUID(false));
    RpcCollector collector = new RpcCollector(key,rpcOptions,destination.length);
    try {
        synchronized (collector) {
            if ( rpcOptions != NO_REPLY ) responseMap.put(key, collector);
            RpcMessage rmsg = new RpcMessage(rpcId, key.id, message);
            channel.send(destination, rmsg, sendOptions);
            if ( rpcOptions != NO_REPLY ) collector.wait(timeout);
        }
    } catch ( InterruptedException ix ) {
        Thread.currentThread().interrupt();
    } finally {
        responseMap.remove(key);
    }
    return collector.getResponses();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:39,代码来源:RpcChannel.java


示例7: createElectionMsg

import org.apache.catalina.tribes.util.UUIDGenerator; //导入依赖的package包/类
private CoordinationMessage createElectionMsg(MemberImpl local, MemberImpl[] others, MemberImpl leader) {
    Membership m = new Membership(local,AbsoluteOrder.comp,true);
    Arrays.fill(m,others);
    MemberImpl[] mbrs = m.getMembers();
    m.reset(); 
    CoordinationMessage msg = new CoordinationMessage(leader, local, mbrs,new UniqueId(UUIDGenerator.randomUUID(true)), COORD_REQUEST);
    return msg;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:9,代码来源:NonBlockingCoordinator.java


示例8: addRandomDomain

import org.apache.catalina.tribes.util.UUIDGenerator; //导入依赖的package包/类
/**
 * Configures a set of channels to use a random domain. Use to ensure that
 * multiple instance of the test suite do not interfere when running on the
 * same machine. This may happen in a CI system or when a developer is
 * running tests for multiple branches in parallel.
 */
public static void addRandomDomain(ManagedChannel[] channels) {
    if (channels == null) {
        return;
    }

    byte[] domain = UUIDGenerator.randomUUID(false);

    for (ManagedChannel channel : channels) {
        channel.getMembershipService().setDomain(domain);
        DomainFilterInterceptor filter = new DomainFilterInterceptor();
        filter.setDomain(domain);
        channel.addInterceptor(filter);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:21,代码来源:TesterUtil.java


示例9: setUp

import org.apache.catalina.tribes.util.UUIDGenerator; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    for (int i = 0; i < channels.length; i++) {
        channels[i] = new GroupChannel();
        channels[i].getMembershipService().setPayload( ("Channel-" + (i + 1)).getBytes("ASCII"));
        listeners[i] = new TestMbrListener( ("Listener-" + (i + 1)));
        channels[i].addMembershipListener(listeners[i]);
        DomainFilterInterceptor filter = new DomainFilterInterceptor();
        filter.setDomain(UUIDGenerator.randomUUID(false));
        channels[i].addInterceptor(filter);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:13,代码来源:TestDomainFilterInterceptor.java


示例10: send

import org.apache.catalina.tribes.util.UUIDGenerator; //导入依赖的package包/类
/**
 * Send a message and wait for the response.
 * 
 * @param destination
 *            Member[] - the destination for the message, and the members
 *            you request a reply from
 * @param message
 *            Serializable - the message you are sending out
 * @param rpcOptions
 *            int - FIRST_REPLY, MAJORITY_REPLY or ALL_REPLY
 * @param channelOptions
 *            channel sender options
 * @param timeout
 *            long - timeout in milliseconds, if no reply is received within
 *            this time null is returned
 * @return Response[] - an array of response objects.
 * @throws ChannelException
 */
public Response[] send(Member[] destination, Serializable message, int rpcOptions, int channelOptions, long timeout)
		throws ChannelException {

	if (destination == null || destination.length == 0)
		return new Response[0];

	// avoid dead lock
	int sendOptions = channelOptions & ~Channel.SEND_OPTIONS_SYNCHRONIZED_ACK;

	RpcCollectorKey key = new RpcCollectorKey(UUIDGenerator.randomUUID(false));
	RpcCollector collector = new RpcCollector(key, rpcOptions, destination.length);
	try {
		synchronized (collector) {
			if (rpcOptions != NO_REPLY)
				responseMap.put(key, collector);
			RpcMessage rmsg = new RpcMessage(rpcId, key.id, message);
			channel.send(destination, rmsg, sendOptions);
			if (rpcOptions != NO_REPLY)
				collector.wait(timeout);
		}
	} catch (InterruptedException ix) {
		Thread.currentThread().interrupt();
	} finally {
		responseMap.remove(key);
	}
	return collector.getResponses();
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:46,代码来源:RpcChannel.java


示例11: createElectionMsg

import org.apache.catalina.tribes.util.UUIDGenerator; //导入依赖的package包/类
private CoordinationMessage createElectionMsg(MemberImpl local, MemberImpl[] others, MemberImpl leader) {
	Membership m = new Membership(local, AbsoluteOrder.comp, true);
	Arrays.fill(m, others);
	MemberImpl[] mbrs = m.getMembers();
	m.reset();
	CoordinationMessage msg = new CoordinationMessage(leader, local, mbrs,
			new UniqueId(UUIDGenerator.randomUUID(true)), COORD_REQUEST);
	return msg;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:10,代码来源:NonBlockingCoordinator.java


示例12: send

import org.apache.catalina.tribes.util.UUIDGenerator; //导入依赖的package包/类
/**
 * Send a message and wait for the response.
 * @param destination Member[] - the destination for the message, and the members you request a reply from
 * @param message Serializable - the message you are sending out
 * @param rpcOptions int - FIRST_REPLY, MAJORITY_REPLY or ALL_REPLY
 * @param channelOptions channel sender options
 * @param timeout long - timeout in milliseconds, if no reply is received within this time null is returned
 * @return Response[] - an array of response objects.
 * @throws ChannelException
 */
public Response[] send(Member[] destination, 
                       Serializable message,
                       int rpcOptions, 
                       int channelOptions,
                       long timeout) throws ChannelException {
    
    if ( destination==null || destination.length == 0 ) return new Response[0];
    
    //avoid dead lock
    int sendOptions =
        channelOptions & ~Channel.SEND_OPTIONS_SYNCHRONIZED_ACK;
    
    RpcCollectorKey key = new RpcCollectorKey(UUIDGenerator.randomUUID(false));
    RpcCollector collector = new RpcCollector(key,rpcOptions,destination.length);
    try {
        synchronized (collector) {
            if ( rpcOptions != NO_REPLY ) responseMap.put(key, collector);
            RpcMessage rmsg = new RpcMessage(rpcId, key.id, message);
            channel.send(destination, rmsg, sendOptions);
            if ( rpcOptions != NO_REPLY ) collector.wait(timeout);
        }
    } catch ( InterruptedException ix ) {
        Thread.currentThread().interrupt();
    }finally {
        responseMap.remove(key);
    }
    return collector.getResponses();
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:39,代码来源:RpcChannel.java


示例13: send

import org.apache.catalina.tribes.util.UUIDGenerator; //导入依赖的package包/类
/**
 * Send a message and wait for the response.
 * @param destination Member[] - the destination for the message, and the members you request a reply from
 * @param message Serializable - the message you are sending out
 * @param rpcOptions int - FIRST_REPLY, MAJORITY_REPLY or ALL_REPLY
 * @param channelOptions channel sender options
 * @param timeout long - timeout in milliseconds, if no reply is received within this time null is returned
 * @return Response[] - an array of response objects.
 * @throws ChannelException
 */
public Response[] send(Member[] destination, 
                       Serializable message,
                       int rpcOptions, 
                       int channelOptions,
                       long timeout) throws ChannelException {
    
    if ( destination==null || destination.length == 0 ) return new Response[0];
    
    //avoid dead lock
    int sendOptions =
        channelOptions & ~Channel.SEND_OPTIONS_SYNCHRONIZED_ACK;
    
    RpcCollectorKey key = new RpcCollectorKey(UUIDGenerator.randomUUID(false));
    RpcCollector collector = new RpcCollector(key,rpcOptions,destination.length,timeout);
    try {
        synchronized (collector) {
            if ( rpcOptions != NO_REPLY ) responseMap.put(key, collector);
            RpcMessage rmsg = new RpcMessage(rpcId, key.id, message);
            channel.send(destination, rmsg, sendOptions);
            if ( rpcOptions != NO_REPLY ) collector.wait(timeout);
        }
    } catch ( InterruptedException ix ) {
        Thread.currentThread().interrupt();
    }finally {
        responseMap.remove(key);
    }
    return collector.getResponses();
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:39,代码来源:RpcChannel.java



注:本文中的org.apache.catalina.tribes.util.UUIDGenerator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ServletContainerInitializerInfo类代码示例发布时间:2022-05-23
下一篇:
Java CBLocation类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap