首页 \ 问答 \ 几个netty服务器之间的netty共享通道(netty share channels between several netty servers)

几个netty服务器之间的netty共享通道(netty share channels between several netty servers)

我使用手表并实现了一些自定义物联网逻辑。 我正在使用netty从手表接收连接,并存储一些数据,并使用该方法正常工作。 但我有新的要求发送一些命令来观看。 为了做到这一点,我可以将命令发送到Netty上已经打开的频道,但采用这种方法我需要用imei存储某处地图并打开netty频道 。 有没有解决方案? 或者这种方法很好......


I using watches and implementing some custom IoT logic. I'm using netty to receive connection from watch and store some data and everyting working fine with that approach. But I got new requirement to send some command to watch. In order to do that I can send command to already opened channel on Netty but with that approach I need to store somewhere map with imei and opened netty channel. Are there some solutions for that? Or probably this approach is fine...


原文:https://stackoverflow.com/questions/47770122
更新时间:2023-05-01 21:05

最满意答案

因为一个类可以实现多个接口,但只能扩展一个抽象类。


because a class can implement multiple interfaces, but only extend a single abstract class.

相关问答

更多
  • 你在哪里遇到了你发布的代码块,任何旧的java代码库? 这就是JLS所说的: 9.1.1.1抽象接口: 每个接口都是隐含抽象的。 此修饰符已过时,不应在新程序中使用。 9.4抽象方法声明: 为了与旧版本的Java平台兼容,对于在接口中声明的方法,可以冗余地指定抽象修饰符,但不允许这样做。 Where did you come across the chunk of code you have posted, any old java code base ? This is what the JLS has ...
  • 抽象类允许您为其余代码创建基石。 您可以创建部分实现的类,然后允许用户创建更具体的需求的具体实例。 常用功能保留在抽象类中。 真实世界的比喻是汽车租赁店。 他们雇用'汽车'。 “汽车”的概念是一个抽象类,可以在他们的系统中有各种方法,允许雇用和返回,以及保险集团,每日费率等属性。但是, 没有客户会去租用商店并雇用'汽车'。 他们雇用了福特福克斯,梅赛德斯,斯柯达法比亚等等。 所以这些是抽象类的具体实例,并且很可能在面向对象的系统中表示,该系统具有从'car'派生的特定类。 另一方面,接口允许多态性 。 这是 ...
  • 接口 一个界面是一个契约 :编写界面的人说:“ 嘿,我接受这样的事情 ”,使用界面的人说“ OK,我写的类看起来像这样 ”。 一个界面是一个空的shell 。 只有方法的签名,这意味着这些方法没有一个正文。 界面无法做任何事情。 这只是一种模式。 例如(伪代码): // I say all motor vehicles should look like this: interface MotorVehicle { void run(); int getFuel(); } // My te ...
  • 我想知道为什么java集合具有所有类抽象。 这个假设是错误的,因为你在Collections框架中有Collection,List和Set等接口。 为什么他们不实现接口而不是抽象类。 如果你的意思是AbstractList,AbstractSet ..etc,因为提供了接口无法实现的基本实现(在java8下面) 最后结合你的两点你可以看到 AbstractList implements Iterable, Collection, List {} I do like to know ab ...
  • 假设您正在开发一个具有IStream接口的流行库,该库在整个库中的各种API中使用。 IStream有以下方法: int Read(byte[] buffer, int offset, int count); void Write(byte[] buffer, int offset, int count); 但是,不是让人们直接实现该接口,而是强烈建议他们从您的抽象类Stream继承,它实现该接口,如下所示: public abstract int Read(byte[] buffer, int offs ...
  • 一个接口只能定义常量,而抽象类可以有字段。 你的接口领域是隐式public , static , final 这与抽象类没有关系 An interface can only define constants while abstract class can have fields. your field from interface is by implicitly public, static, final which isn't case with abstract class
  • 如果您想使用与基类相同的代码并使用额外的功能扩展它,那么从基类继承是非常有用的。 与此有关的是虚拟的和抽象的。 您可以使用基本实现制作虚拟方法。 后代类可以(可选)更改或添加到此实现。 抽象类本身是不完整的基类。 抽象方法被声明,但尚未实现。 后代类必须提供一个实现。 如果基类实现一个流,但这个流的一部分需要由另一个类来实现,这非常有用。 基类需要能够调用那个部分,这是宣布一个抽象方法的地方。 接口是一个不同的故事。 接口是一个关于哪些方法存在于类中的合约,但它们可以由两个完全无关的类来实现。 这很方便,因 ...
  • 它们不是抽象的 - 它们是由界面定义的契约。 “abstract”具有特定含义,仅适用于类。 话虽这么说,它们的行为与类中的抽象成员非常相似 - 实现接口的任何类型都必须实现成员或者是抽象本身。 They are not abstract - they are a contract defined by the interface. "abstract" has a specific meaning which only applies to classes. That being said, they a ...
  • 因为一个类可以实现多个接口,但只能扩展一个抽象类。 because a class can implement multiple interfaces, but only extend a single abstract class.
  • and the other question is even the abstract classes can not be instantiated, then why it can have a non static data member?? 因为在抽象类中,您可以定义所需的功能,然后可以由其子项使用。 and the other question is even the abstract classes can not be instantiated, then why it can have a ...

相关文章

更多

最新问答

更多
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • linux的常用命令干什么用的
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • Java中的不可变类(Immutable class in Java)
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • 绑定属性设置器未被调用(Bound Property Setter not getting Called)
  • linux ubuntu14.04版没有那个文件或目录
  • 如何使用JSF EL表达式在param中迭代变量(How to iterate over variable in param using JSF EL expression)
  • 是否有可能在WPF中的一个单独的进程中隔离一些控件?(Is it possible to isolate some controls in a separate process in WPF?)
  • 使用Python 2.7的MSI安装的默认安装目录是什么?(What is the default installation directory with an MSI install of Python 2.7?)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • ckeditor config.protectedSource不适用于editor.insertHtml上的html元素属性(ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 将CouchDB与AJAX一起使用是否安全?(Is it safe to use CouchDB with AJAX?)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • 无法在新线程中从FREContext调用getActivity()?(Can't call getActivity() from FREContext in a new thread?)
  • 在Alpine上升级到postgres96(/ usr / bin / pg_dump:没有这样的文件或目录)(Upgrade to postgres96 on Alpine (/usr/bin/pg_dump: No such file or directory))
  • 如何按部门显示报告(How to display a report by Department wise)
  • Facebook墙贴在需要访问令牌密钥后无法正常工作(Facebook wall post not working after access token key required)
  • Javascript - 如何在不擦除输入的情况下更改标签的innerText(Javascript - how to change innerText of label while not wiping out the input)
  • WooCommerce / WordPress - 不显示具有特定标题的产品(WooCommerce/WordPress - Products with specific titles are not displayed)