All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.litongjava.tio.core.PacketSendMode Maven / Gradle / Ivy

There is a newer version: 3.7.3.v20241201-RELEASE
Show newest version
package com.litongjava.tio.core;

/**
 *  消息发送模式
 * @author tanyaowu
 *
 */
public enum PacketSendMode {
	/**
	 * 把packet丢到一个队列中,让线程池去发送
	 */
	QUEUE(1),
	/**
	 * 单条消息阻塞发送,直接发送成功,才折回
	 */
	SINGLE_BLOCK(2),

	/**
	 * 一群消息阻塞发送,直接发送成功,才折回
	 */
	GROUP_BLOCK(3);

	public static PacketSendMode forNumber(int value) {
		switch (value) {
		case 1:
			return QUEUE;
		case 2:
			return SINGLE_BLOCK;
		case 3:
			return GROUP_BLOCK;
		default:
			return null;
		}
	}

	private final int value;

	private PacketSendMode(int value) {
		this.value = value;
	}

	/**
	 * @return the value
	 */
	public int getValue() {
		return value;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy