Global Services
摘要:下面这段内容来自《the definitive guide to netbeans platform》,回答了一个困扰我的问题:对于全局只有一个实例,且需要在多个模块访问的类如何实现,使用普通的单例模式还是使用Service,二者都有缺点,还是下面的全局服务的模式比较好。————————————————————————————————————————————————————————————————————Global services—i.e., services that can be used by multiple modules and that are only providedby
阅读全文
posted @
2011-09-29 09:20
网络大豆
阅读(321)
推荐(0) 编辑
When should I use RequestProcessor.getDefault() and when should I create my own RequestProcessor?
摘要:http://wiki.netbeans.org/DevFaqRequestProcessor————————————————————————————————————————————————————————————————————————RequestProcessor.getDefault() is tempting to use, but it is also dangerous. This FAQ item will tell you when not to use it. One of the most common threading bugs in NetBeans happen.
阅读全文
posted @
2011-09-28 14:48
网络大豆
阅读(170)
推荐(0) 编辑
按照netbeans的习惯开发
摘要:在使用Netbeans RCP进行开发的时候,我们通常要设计一些用户界面元素,在设计的时候最好按照Netbeans的习惯,这样开发的时候会比较顺畅。否则经常会感到整体界面不协调。而Netbeans因为久经考验,其界面通常是比较获得认可的。下面我总结一些这样的习惯,仅代表个人观点,欢迎大家补充。在editor模式下打开的TopComponent通常不是单例的,即同一个TopComponent通常可以打开多次。而单例的TopComponent通常不在editor中打开。涉及后台的长时间运行的任务通常使用Progress API实现。
阅读全文
posted @
2011-09-28 14:21
网络大豆
阅读(255)
推荐(0) 编辑
Progress API
摘要:按照java doc上的例子,进度条不显示Use Cases Basic usage There are 3 types of progress indication: 1. indefinite when it's not known how much time will be needed to complete2. definite with time estimate for completion (UI shows time that remains)3. definite without time estimate where the UI shows percen...
阅读全文
posted @
2011-09-28 14:04
网络大豆
阅读(498)
推荐(0) 编辑
NetBeans Platform APIs: Top 10 Runners Up
摘要:http://blogs.oracle.com/geertjan/entry/netbeans_platform_apis_top_10————————————————————————————————————————————————————————————————————————If yesterday's list of NetBeans APIs are to be seen as the NetBeans Platform's "Top 10 Greatest Hits" (the 10th place is still open to suggest
阅读全文
posted @
2011-09-27 18:44
网络大豆
阅读(370)
推荐(0) 编辑
New NetBeans API For Adding Close Button to JTabbedPane
摘要:http://blogs.oracle.com/geertjan/entry/netbeans_apis_add_close_button————————————————————————————————————————————————————————————————————————One of the many esoterically ongoing discussions in the Swing world is that of "The Missing Close Button on JTabbedPanes". (To see a selection of the
阅读全文
posted @
2011-09-27 18:42
网络大豆
阅读(370)
推荐(0) 编辑
org.openide.awt.DropDownButtonFactory
摘要:http://blogs.oracle.com/geertjan/entry/org_openide_awt_dropdownbuttonfactory1————————————————————————————————————————————————————————————————————I was learning about org.openide.awt.DropDownButtonFactory yesterday, because of the cool Profiler drop-down buttons in the IDE's toolbar. I assumed th
阅读全文
posted @
2011-09-27 18:39
网络大豆
阅读(494)
推荐(0) 编辑
Code for Rerun DropDownButtonFactory
摘要:http://blogs.oracle.com/geertjan/entry/code_for_rerun_dropdownbuttonfactory——————————————————————————————————————————————————————————————————————I made some serious progress with my redeploy plugin today. Since it was inspired by Gareth Uren, who liked this functionality in Eclipse and misses it i..
阅读全文
posted @
2011-09-27 18:36
网络大豆
阅读(307)
推荐(0) 编辑
Node Hierarchy Reordering via Children.Keys
摘要:http://blogs.oracle.com/geertjan/?page=9———————————————————————————————————————————————————————————————————————— This time, for the first time in my blog, via Children.Keys: publicclassMyObjectChildrenextendsChildren.Keys<MyObject>implementsIndex{privateIndexindexSupport;@Overrideprotectedvoid
阅读全文
posted @
2011-09-26 17:15
网络大豆
阅读(260)
推荐(0) 编辑
Zoom Capability
摘要:http://blogs.oracle.com/geertjan/?page=6——————————————————————————————————————————————————————————————————————Look at the Zoom buttons in the extreme left of the toolbar below. In the first screenshot, the selected window does not require zoomability, hence the buttons are disabled... ...while ...
阅读全文
posted @
2011-09-25 09:24
网络大豆
阅读(417)
推荐(0) 编辑
Predefining the Installation Folder in the NetBeans Installer Framework
摘要:http://blogs.oracle.com/geertjan/entry/predefining_the_installation_folder_in————————————————————————————————————————————————————————————-——————Derek, who I suspect of being Derek Witt from the Jewelry Customer Manager on the NetBeans Platform, recently left a comment in this blog about the NetBeans
阅读全文
posted @
2011-09-25 09:19
网络大豆
阅读(317)
推荐(0) 编辑
Better ChildFactory
摘要:http://blogs.oracle.com/geertjan/entry/better_childfactory————————————————————————————————————————————————————————————————————————Thanks to Jesse, here's a corrected & improved ChildFactory from a few days ago, using ChildFactory.Detachable so that you have addNotify/removeNotify to add/remo
阅读全文
posted @
2011-09-25 09:11
网络大豆
阅读(208)
推荐(0) 编辑
Custom Corporate Menu Bar for NetBeans Platform Applications
摘要:http://blogs.oracle.com/geertjan/entry/customizable_corporate_menu_bar_for———————————————————————————————————————————————————————————————————————— Today let's create a highly customized menu bar in our NetBeans Platform application: What's special in ...
阅读全文
posted @
2011-09-25 09:01
网络大豆
阅读(440)
推荐(0) 编辑
Custom Swing Menu Bar with Web-Like Appearance & Behavior
摘要:http://blogs.oracle.com/geertjan/entry/custom_swing_menu_bar_with—————————————————————————————————————————————————————————————————— Yesterday you saw how to provide a highly customized menu bar in a NetBeans Platform application. Let's now take it a few steps further. We imagine that our require
阅读全文
posted @
2011-09-25 09:00
网络大豆
阅读(306)
推荐(0) 编辑
Custom Tabbed Toolbar with Corporate Image and Central Registry Integration
摘要:http://blogs.oracle.com/geertjan/entry/tabbed_toolbar_with_corporate_image——————————————————————————————————————————————————————————————————In the last two days, you have read in this blog how to replace the default menu bar from the NetBeans Platform with your own custom menu bar. The reason for ..
阅读全文
posted @
2011-09-25 08:56
网络大豆
阅读(325)
推荐(0) 编辑
Installing the JRE via an Application's Installer via Windows
摘要:http://blogs.oracle.com/geertjan/entry/installing_the_jre_via_an —————————————————————————————————————————————————————————————————— In contrast to Ern
阅读全文
posted @
2011-09-25 08:50
网络大豆
阅读(708)
推荐(0) 编辑
Presenter.Toolbar Meets @Action Annotations
摘要:http://blogs.oracle.com/geertjan/entry/presenter_toolbar_meets_action_annotations————————————————————————————————————————————————————————————————————————Let's say you have a JPanel that you'd like to integrate into the NetBeans Platform toolbar. As an example, we imagine that this is the JPa
阅读全文
posted @
2011-09-24 17:46
网络大豆
阅读(261)
推荐(0) 编辑
FireFox Personas for the NetBeans Platform
摘要:http://blogs.oracle.com/geertjan/entry/firefox_personas_for_the_netbeans————————————————————————————————————————————————————————————————————————While thinking about Henry's Nimbus challenges, I received a great tip from NetBeans Platform window system guru Stan Aubrecht: There's a small API
阅读全文
posted @
2011-09-24 17:42
网络大豆
阅读(270)
推荐(0) 编辑
Custom Corporate Background for NetBeans Platform Applications
摘要:http://blogs.oracle.com/geertjan/entry/custom_corporate_background_for_netbeans——————————————————————————————————————————————————————————————————Dunder Mifflin and any other organization out there can quite easily brand the background of their application on the NetBeans Platform, with this result..
阅读全文
posted @
2011-09-24 17:22
网络大豆
阅读(192)
推荐(0) 编辑
NetBeans IDE 7.1 Window Layout Designer
摘要:http://blogs.oracle.com/geertjan/entry/netbeans_ide_7_1_window——————————————————————————————————————————————————————————————————In 7.1, you'll see this in the New File dialog: I.e., as you can see, there'll be two new file templates. One for creating & registering a new layer file (hurra
阅读全文
posted @
2011-09-24 17:11
网络大豆
阅读(333)
推荐(0) 编辑
Open File Dialog in the NetBeans Platform
摘要:http://blogs.oracle.com/geertjan/entry/open_file_dialog_in_the——————————————————————————————————————————————————————————————————————When you use the "NetBeans Platform Application" template in NetBeans IDE and you make no changes of any kind, simply run it, you'll find that your "
阅读全文
posted @
2011-09-24 16:52
网络大豆
阅读(392)
推荐(0) 编辑
java反编译工具jd-gui-0.3.3.windows
摘要:This is README file for Java Decompiler.JD home page: http://java.decompiler.free.frCopyright 2008-2010 Emmanuel Dupuy.1. Installation.No installation and no setup are required.2. DescriptionJD-GUI is a standalone graphical utility that displays Java source codes of ".class" files. You can
阅读全文
posted @
2011-09-24 16:06
网络大豆
阅读(1483)
推荐(0) 编辑
Node中的explorer views的双击事件
摘要:重写getPreferredAction()方法即可publicclassUserNodeextendsAbstractNode{publicUserNode(PeerInfopeerInfo){super(Children.LEAF,Lookups.singleton(peerInfo));this.setName(peerInfo.getPeerID());this.setDisplayName(peerInfo.getName());}@OverridepublicAction[]getActions(booleanpopup){returnnewAction[]{newChatActi
阅读全文
posted @
2011-09-23 15:17
网络大豆
阅读(306)
推荐(0) 编辑
java鼠标双击和右键事件处理
摘要:http://hi.baidu.com/kaka888/blog/item/baddcb1bb3c9b5fbae513376.htmlpublicclassMyMouseListenerextendsMouseAdapter{publicvoidmouseClicked(MouseEventevt){if(evt.getClickCount()==3){//处理鼠标三击}elseif(evt.getClickCount()==2){//处理鼠标双击}}}处理鼠标右键publicmouseClicked(MouseEvente){if(e.isMetaDown()){//检测鼠标右键单击}如何在
阅读全文
posted @
2011-09-23 12:05
网络大豆
阅读(5094)
推荐(0) 编辑
判断ImageIcon创建成功
摘要:ImageIconimageIcon=newImageIcon(file.getPath());if(imageIcon.getImageLoadStatus()==MediaTracker.COMPLETE){editTP.insertIcon(newImageIcon(file.getPath()));}else{//图像加载失败,igonre}
阅读全文
posted @
2011-09-23 09:59
网络大豆
阅读(339)
推荐(0) 编辑
测试一台机器能同时开多少管道
摘要:稍后公布测试结果。----------------------------------------------------------------------------------------------- 好多好多,难道管道是一种很便宜的资源?若如此,则管道用完后可以一直保持连接的状态,那就太好了!暂时管道先不要关闭,如果有问题再处理好了 ——————————————————————————————————以下内容来自http://www.cnblogs.com/cuizhf/archive/2011/10/12/2208026.html 最近的JXTA Java SE 2.5版本,...
阅读全文
posted @
2011-09-22 20:53
网络大豆
阅读(370)
推荐(0) 编辑
带返回值的函数如何在内部同步?
摘要:《Java线程》第三版中找到的一个例子(见P163):pubilcintgetCorrectNum(intc){synchronized(correctChars){Integerkey=newInteger(c);Integernum=(Integer)correctChars.get(key);if(num==null){return0;}returnnum.intValue();}} 原来synchronized块可以直接把返回语句包括其中。
阅读全文
posted @
2011-09-22 18:42
网络大豆
阅读(308)
推荐(0) 编辑
ubuntu中查看cpu, 显卡
摘要:查看cpu信息可以使用 cat /proc/cpuinfo 查看显卡使用 lspci |grep VGA
阅读全文
posted @
2011-09-22 12:41
网络大豆
阅读(1193)
推荐(0) 编辑
JXSE网络在后台运行的线程
摘要:JXSE网络启动后,后台需要很多线程执行任务,下面列举典型的几个例子:------------------------------------------------------------------------------------------------------------------使用了ReliableOutputStream,会启动一个重传任务RetransmitTask(因为要保证可靠传输)。其中JxtaBiDiPipe和JxtaSocket都使用了ReliableOutputStream,因此都能保证可靠传输。 /***Acceptsdataandpackagesitin
阅读全文
posted @
2011-09-22 10:37
网络大豆
阅读(391)
推荐(0) 编辑
JTextPane/DefaultStyledDocument的序列化的相关问题
摘要:java.io.InvalidClassException: javax.swing.text.DefaultStyledDocument; local class incompatible: stream classdesc serialVersionUID = 940485415728614849, local class serialVersionUID = 7691029896427935656 at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:579) at java.io.ObjectInputStre
阅读全文
posted @
2011-09-21 16:37
网络大豆
阅读(702)
推荐(0) 编辑
JTextPane自动滚动到末尾
摘要:javax.swing.text.Documentdoc=jTextPane.getDocument();jTextPane.setCaretPosition(doc.getLength());
阅读全文
posted @
2011-09-21 12:00
网络大豆
阅读(290)
推荐(0) 编辑
征途2淮阳寻宝源代码(无说明,自己备用:)
摘要:屏幕截图(记不清了,大概参考了http://hadeslee.iteye.com/的JAVA截屏程序,源码链接已失效,故无法确认)javasift图像匹配算法(http://fly.mpi-cbg.de/~saalfeld/Projects/javasift.html)限于文件大小,已去掉相关素材 /Files/cuizhf/TreasureHunter.rar
阅读全文
posted @
2011-09-21 10:11
网络大豆
阅读(462)
推荐(0) 编辑
JxtaBiDiPipe的RetryingOutputPipeConnect中的周期性任务耗费时间过长///Long Task Detector warning
摘要:以下是堆栈task of type [net.jxta.util.JxtaBiDiPipe$RetryingOutputPipeConnect$1] still running after 96,001ms in thread JxtaScheduledWorker-1, current stack:sun.misc.Unsafe.park(Native Method)java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)java.util.concurrent.locks.AbstractQueuedSynchron
阅读全文
posted @
2011-09-21 09:37
网络大豆
阅读(810)
推荐(0) 编辑
Java Swing之StyledDocument的合并
摘要:http://blog.fyent.net/2011/01/java_swing_merge_styleddocument/publicvoidmergeDocument(DefaultStyledDocumentsource,DefaultStyledDocumentdest)throwsBadLocationException{ArrayListspecs=newArrayList();DefaultStyledDocument.ElementSpecspec=newDefaultStyledDocument.ElementSpec(newSimpleAttributeSet(),Defa
阅读全文
posted @
2011-09-20 23:37
网络大豆
阅读(1003)
推荐(0) 编辑
How to Use File Choosers
摘要:http://download.oracle.com/javase/tutorial/uiswing/components/filechooser.html
阅读全文
posted @
2011-09-20 21:49
网络大豆
阅读(177)
推荐(0) 编辑
JxtaBiDiPipe主动连接的问题
摘要:首先看几个connect方法/***ConnecttoaJxtaServerPipewithdefaulttimeout**@paramgroupgroupcontext*@parampipeAdPipeAdvertisement*@throwsIOExceptionifanioerroroccurs*/publicvoidconnect(PeerGroupgroup,PipeAdvertisementpipeAd)throwsIOException{connect(group,pipeAd,timeout);}/***ConnectstoaremoteJxtaBiDiPipe**@param
阅读全文
posted @
2011-09-20 13:50
网络大豆
阅读(423)
推荐(0) 编辑
Swing Threading的限制
摘要:一个GUI程序是具有数个thread的,这些thread之中有一个被称为时间派发(event-dispatching) thread。这个thread运行程序中所有与事件有关的回调(callback),如打字游戏中的actionPerformed()与keyPressed()方法。对所有Swing对象的访问都必须发生在此thread中。之所以需要这样的原因是Swing并没有用同步来访问本身对象的复杂内在状态。以JSlider对象为例,它有个用来指示slider位置的单一值。如果使用者正在改变此slider的位置,该值可能正位于中间或尚未确定的状态,这样的处理全部都是发生在事件派发thread中
阅读全文
posted @
2011-09-20 10:57
网络大豆
阅读(191)
推荐(0) 编辑
JTextPane例子,演示为文字设置字体、字号、样式、颜色、背景色和插入图片功能
摘要:http://blog.csdn.net/mq612/article/details/1254349 importjava.awt.BorderLayout;importjava.awt.Color;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.io.File;importjavax.swing.BorderFactory;importjavax.swing.Box;importjavax.swing.ImageIcon;importjavax.swing...
阅读全文
posted @
2011-09-20 10:05
网络大豆
阅读(1404)
推荐(0) 编辑
又见net.jxta.exception.ServiceNotFoundException
摘要:与以前帖子中提到的原因(JXSE的bug)不一样,不过这个也蛮奇怪的。异常堆栈提示并不明显。在一堆日志中发现这么几行:Exception in startApp() : jxmessenger.jxse.presenceservice.PresenceServiceImpl@1a33efbjava.lang.NullPointerExceptionLine 202 net.jxta.socket.JxtaMulticastSocket.joinGroup().... Service failed to start (-1) : jxmessenger.jxse.presenceservice.
阅读全文
posted @
2011-09-19 16:11
网络大豆
阅读(745)
推荐(1) 编辑
Linux 下用ps查找进程并用kill终止命令详解
摘要:http://www.15897.com/blog/post/Linux-ps-kill.html最近夜火我在折腾Ubuntu 9.04系统,直接硬盘安装在学校的机器上,已经折腾了3天了。第一天全放在了重装windows XP和安装整理必要文件上了;第二天安装了GRUB4DOS,硬盘引导加载 Ubuntu-9.04-desktop-i386.iso 文件安装Ubuntu,但是装好之后一直memtest内存测试,引导不进系统;这第三天又捣鼓了1天的grub,最终还是不行,没有vmlinuz-2.6.28-11-generic文件。明天继续。。。学校的破网络,只能上百度首页和看PPS,其他什么都不
阅读全文
posted @
2011-09-19 00:19
网络大豆
阅读(728)
推荐(0) 编辑
SwingSet2
摘要:/Files/cuizhf/SwingSet2.jar.txt双击执行,或命令行:java -jar SwingSet2.jar
阅读全文
posted @
2011-09-15 10:03
网络大豆
阅读(615)
推荐(0) 编辑
java集合的交并差补操作
摘要:http://johnjobe.iteye.com/blog/1017984在实现数据挖掘一些算法或者是利用空间向量模型来发现相似文档的时候,会遇到求两个集合的交集的情况。以前一般是采用比较笨拙的办法,依次遍历其中一个集 合的元素,然后判断它是否包含在另一个集合中。这样做非常机械繁琐,代码编得让人心烦,其实java的api中提供了对集合进行交、并、差运算的功能,灰 常强大!看下面的例子:1.publicclassSetOpt{2.3.publicListintersect(Listls,Listls2){4.Listlist=newArrayList(Arrays.asList(newObje
阅读全文
posted @
2011-09-14 21:33
网络大豆
阅读(1188)
推荐(0) 编辑
PropertyUtils.copyProperties的性能
摘要:一共执行了10次,每次先用PropertyUtils.copyProperties,再用逐个域值拷贝的方式。奇怪的时第一次中使用PropertyUtils.copyProperties居然用了530毫秒,这是为什么呢??虽然使用PropertyUtils.copyProperties,会方便一些,但性能确实下降了很多(第一次)。5300---------------------1-------------------------10---------------------2-----------------------11---------------------3------------.
阅读全文
posted @
2011-09-14 20:44
网络大豆
阅读(947)
推荐(0) 编辑
Programmatically Putting TopComponents in Modes
摘要:http://blogs.oracle.com/geertjan/entry/programmatically_putting_topcomponents_in_modesFirst a picture: 图片略 The list of menu items above appears when the TopComponent's tab is right-clicked. When a menu item is selected, the TopComponent moves to the selected mode. Next, the two things you need .
阅读全文
posted @
2011-09-14 12:23
网络大豆
阅读(357)
推荐(0) 编辑
Secrets of the NetBeans Window System
摘要:http://netbeans.dzone.com/news/secrets-netbeans-window-system&sa=U&ei=JPBvTqSlNsSXiQfC1JGsCQ&ved=0CCQQFjAI&usg=AFQjCNEZyrb8mNth56umvuSGJiGKj3JCnAToday I learned about some hidden options of the NetBeans Window System. These can't be set via user interface elements in the NetBeans
阅读全文
posted @
2011-09-14 08:50
网络大豆
阅读(433)
推荐(0) 编辑
把JXSE的日志输出到控制台
摘要:Displaying additional log informationIf your JXTA application isn't behaving as you expect, you can turn on additional logging so that more information is displayed when your application runs.The JavaDoc for the net.jxta.logging.Logging class provides complete instructions and examples for enabl
阅读全文
posted @
2011-09-13 12:22
网络大豆
阅读(360)
推荐(0) 编辑
DiscoveryService.getRemoteAdvertisements是否会获得本地通告?
摘要:从该方法名称上来说,应该是不能获得本地通告,本着探究的精神,首先做个小测试,再从源代码中寻找答案。----------------------------------------------------------------------------- 测试结果:本地通告确实取不到,从源代码看不出来(水平不够啊,对JXSE底层架构不清楚)。这样的话有些情况就不好处理,例如:利用通告实现在线感知功能,如果系统中只剩下两个用户A和B,如果用户B发生某些异常(例如网路中断),这时候A通过getRemoteAdvertisements试图发现B的通告,此时B因为网络中断,不会响应这个请求,而根据上面的
阅读全文
posted @
2011-09-13 10:56
网络大豆
阅读(251)
推荐(0) 编辑
java.io.IOException: Datagram can not accomodate message of size :xxx
摘要:publicvoidrun(){ byte[]buffer=newbyte[16384]; DatagramPacketpacket=newDatagramPacket(buffer,buffer.length); try{for(;;){//pool正在关闭(shutdown)时不在接收数据if(!pool.isShutdown()&&!pool.isTerminated()){mcastSocket.receive(packet);pool.execute(newHandler(packet));}else{LOG.info("JxtaMulticastSocke
阅读全文
posted @
2011-09-13 10:09
网络大豆
阅读(353)
推荐(0) 编辑
windowClosed事件不响应
摘要:如下,windowOpened响应,但关闭主窗口时windowClosed不响应,不知道什么原因。publicclassInstallerextendsModuleInstall{@Overridepublicvoidrestored(){//TODOSwingUtilities.invokeLater(newRunnable(){@Overridepublicvoidrun(){WindowManager.getDefault().getMainWindow().addWindowListener(newWindowAdapter(){@OverridepublicvoidwindowOpe
阅读全文
posted @
2011-09-12 20:24
网络大豆
阅读(690)
推荐(0) 编辑
java.io.StreamCorruptedException: invalid stream header: 00000000
摘要:java.io.StreamCorruptedException: invalid stream header: 00000000序列化时抛出此异常,原因是因为疏忽传入了一个空的缓冲,注意00000000,这是由于空的缓冲造成的。部分代码如下:byte[]buffer=newbyte[16384];//16kDatagramPacketpacket=newDatagramPacket(buffer,buffer.length);while(true){mcastSocket.receive(packet);ObjectInputStreamin=newObjectInputStream(new
阅读全文
posted @
2011-09-12 13:38
网络大豆
阅读(14484)
推荐(1) 编辑
改变状态栏信息
摘要:当要更改状态栏信息时,只需要简单地调用StatusDisplayer.getDefault().setStatusText("Something");----------------------------------------------------------------------------发现个问题:状态栏在显示设置的信息几秒后消失,不知道怎么回事?
阅读全文
posted @
2011-09-12 09:24
网络大豆
阅读(250)
推荐(0) 编辑
ModuleInstall注册主窗口监听器
摘要:publicclassInstallextendsMouduleInstall{@Overridepublicvoidrestored(){SwingUtilities.invokeLater(newRunnable(){publicvoidrun(){WindowManager.getDefault().getMainWindow().addWindowListener(newWindowAdapter(){publicvoidwindowOpened(WindowEvente){ // LifecycleManager.getDefault().exit();}});}});}}
阅读全文
posted @
2011-09-12 09:14
网络大豆
阅读(324)
推荐(0) 编辑
Java单例的例子
摘要://SingletonwithpublicfinalfieldpublicclassElvis{publicstaticfinalElvisINSTANCE=newElvis();privateElvis(){...}publicvoidleaveTheBuilding(){...}}//singletonwithstaticfactorypublicclassElvis{privatestaticfinalElvisINSTANCE=newElvis();privateElvis(){...}publicstaticElvisgetInstance(){returnINSTANCE;}pub
阅读全文
posted @
2011-09-11 21:03
网络大豆
阅读(413)
推荐(0) 编辑
序列化和线程安全
摘要:两个线程,其中一个线程对某个实例进行功能新操作,另一个线程将同一个实例序列化后通过网络发送。如何保证线程安全。----------------------------------------------------------------------------------------网上这方面的资料只有寥寥几篇。先贴上这个靠谱点的http://www.zx2010.com/question/java-serialization-objects-multithreaded-environment.aspI have an object whose internal mutable state
阅读全文
posted @
2011-09-10 21:02
网络大豆
阅读(1003)
推荐(0) 编辑
Java序列化的例子
摘要:importjava.io.ByteArrayInputStream;importjava.io.ByteArrayOutputStream;importjava.io.ObjectInputStream;importjava.io.ObjectOutputStream;importjava.io.Serializable;publicclassMessageContainerimplementsSerializable{//管道对通告privatebyte[]pairOfPipesAdv;//privateStringwhatToDo;//我的IDprivateStringuserID;//
阅读全文
posted @
2011-09-10 11:47
网络大豆
阅读(491)
推荐(0) 编辑
关于自定义通告ID的设置
摘要:抽象类Advertisemnt中有一个抽象方法/***ReturnsanIDwhichidentifiesthis{@codeAdvertisement}asuniquelyas*possible.ThisIDistypicallyusedastheprimarykeyforindexingof*theAdvertisementwithindatabases.*<p/>*Eachadvertisementsub-classmustchooseanappropriateimplementation*whichreturnscanonicalandrelativelyuniqueIDv
阅读全文
posted @
2011-09-10 09:55
网络大豆
阅读(299)
推荐(0) 编辑
同时加入两个对等组,在一个对等组中能不能发现另一个对等组发布的通告?
摘要:突然想到这个问题,以前理所当然认为肯定不能发现!现在想来未必不能啊,还是实践一下。----------------------------------------------------------------------------------------------------------------------------- 刚才测试了一下,在NetPeerGroup下建了一个对等组暂且名为RootPeerGroup。然后在RootPeerGroup下发布通告adv。然后先后调用NetPeerGroup和RootPeerGroup的发现服务执行getLocalAdvertisements
阅读全文
posted @
2011-09-09 11:18
网络大豆
阅读(424)
推荐(0) 编辑
想搞清楚remotePublish可以看看这篇文章(考验英语水平的时间到了)
摘要:http://www.java.net/external?url=http://blogs.sun.com/bondolo/entry/don_t_rely_on_remotepublishDon't Rely on remotePublish() By bondolo on Apr 20, 2007Since it's earliest versions the JXTA JSE API has included remotePublish() as part of the Discovery API. This is unfortunate because remotePu
阅读全文
posted @
2011-09-09 10:11
网络大豆
阅读(362)
推荐(0) 编辑
列举一下最近开发中遇到的问题
摘要:1 在线感知功能的优化,能否与组播结合。 OK2 跨模块注入Action时,用户当前选项信息的传递。 暂时在同一模块中处理,不需跨模块。3 Query Service中查询请求的派发。 Ok4 用户网络异常中断后重新连接上,此时如何获取用户列表(要求其他结点响应)。OK5 系统只存在两用户,其中一用户异常离线,另一用户无法刷新问题。 OK6 周期性任务执行时间过长 7 最近遇到的一些问题归根结底为以下情况:本地结点异常离线,参考QQ的处理,本地所有好友显示为离线状态,且时延很短,用户几乎立刻就可以感觉到。除本地结点外,网络中的其他所有结点异常离线。目前这种情况也无法判断。这是正常情况,即系统中
阅读全文
posted @
2011-09-07 16:37
网络大豆
阅读(165)
推荐(0) 编辑
关于ResolverService
摘要:ResolverService使用的消息包括ResolverQueryMsg和ResolverResponseMsg,这些消息中只能加载字符串类型的数据,因此不能支持序列化,无法利用序列化带来的好处。无法序列化使得许多设计模式没有了用武之地。一个解决方式是将对象序列化后的字节数组重新编码为字符串(可以借助某些库例如commons-codec实现),但是这样处理是否太丑了;而且有违ResolverService的原意(否则它就应该提供二进制传输的能力)。在使用管道进行通信时是支持二进制消息的。----------------------------------------------------
阅读全文
posted @
2011-09-07 15:58
网络大豆
阅读(381)
推荐(0) 编辑
How to inject a new Action into existing Node?
摘要:http://netbeans-org.1045718.n5.nabble.com/How-to-inject-a-new-Action-into-existing-Node-td2986918.htmlHi, I have two modules A and B where B should bring some extensions to A. The module A is a source of custom Nodes and I need to add a new Action into the context menu of such nodes. How can I do th
阅读全文
posted @
2011-09-06 13:57
网络大豆
阅读(278)
推荐(0) 编辑
Eclipse RCP实现自定义闪屏
摘要:1 SplashScreen.javaSplashScreen.java2 Activator::start调用SplashScreen.createSplashThread();3 Application::start调用if(SplashScreen.waitForVisibleSplash()){ // 插入初始化代码:init();}4 ApplicationWorkbenchWindowAdvisor::postWindowOpen调用super.postWindowOpen();SplashScreen.setSplashMessageAndProgressValue("
阅读全文
posted @
2011-09-05 15:31
网络大豆
阅读(323)
推荐(0) 编辑
同步与List
摘要:privateListlisteners=newArrayList();publicvoidaddCharacterListener(CharacterListenercl){ synchronized(listeners){ listeners.add(cl); }}publicvoidremoveCharacterListener(CharacterListenercl){ synchronized(listeners){ listeners.remove(cl); }}publicvoidfireNewCharacter(CharacterSourcesource,intc){ Char
阅读全文
posted @
2011-09-05 15:17
网络大豆
阅读(303)
推荐(0) 编辑
转:面对JXTA,我迷茫了
摘要:面对JXTA我迷茫了 感觉作者认为JXTA还不成熟,但是如果技术都成熟了,还有研究的必要么?----------------------------------------------------------------------------花了点时间手打出来(原pdf不能拷贝),直接贴在下面了。当初在图书馆看到一本P2P技术的书籍,感到万分的激动。感觉P2P技术就是一个先进的分布式系统,前途光明。后来了解了JXTA,才感觉原来P2P是这么回事,想在这个技术上有所研究。但随着了解的深入,我确逐渐迷茫了。1 JXTA现在到底可以做什么?P2P的理念很好,提倡一个平等的对等通讯。但现实里可能么?
阅读全文
posted @
2011-09-04 17:10
网络大豆
阅读(651)
推荐(1) 编辑
Coolface
摘要:网上无意中找到的,但已找不到具体地址,估计这个项目已经夭折了吧感觉《Coolface概要设计》中的图片都是从QQ修改来的Coolface.rarCoolface概要设计
阅读全文
posted @
2011-09-03 17:52
网络大豆
阅读(170)
推荐(0) 编辑
jxsev2.5源代码
摘要:现有的基于jxse的开源项目多使用的是jxse v2.5或更早的版本,所以jxse v2.5的源代码还是有一定的参考价值。从jxse v2.6开始包括v2.7版,陆续废除了若干接口、类和方法,导致在借鉴开源项目的源代码时很不方便,此时可以参考v2.5版的源代码,其中对于这些废弃有一些指导性的说明。jxse-src-2.5jxta-src-2.4.1http://download.huihoo.com/jxta/jse/2.4.1/
阅读全文
posted @
2011-09-03 17:43
网络大豆
阅读(289)
推荐(0) 编辑
ResolverQuery类被废弃的一个构造函数
摘要:老版本的源代码中经常会遇到。publicResolverQuery(java.lang.StringHandlerName,net.jxta.document.StructuredDocumentCredential,java.lang.StringpId,java.lang.StringQuery,intqid)Deprecated.usetheindividualaccessormethodsinstead.Constructadocfromstrings
阅读全文
posted @
2011-09-03 15:56
网络大豆
阅读(255)
推荐(0) 编辑
关于AdvertisementFactory废弃的几个方法
摘要:@DeprecatedpublicstaticAdvertisementnewAdvertisement(MimeMediaTypemimetype,InputStreamstream)throwsIOExceptionDeprecated.PleaseconvertyourcodetoconstructanXMLDocumentusingStructuredDocumentFactoryandthencallnewAdvertisement(XMLElement).Forexample:XMLDocumentxml=(XMLDocument)StructuredDocumentFactory
阅读全文
posted @
2011-09-03 13:29
网络大豆
阅读(296)
推荐(0) 编辑
疑问:同一个结点加入不同的对等组,在不同的对等组中其结点ID是否相同或可以相同?
摘要:直觉上来说似乎结点id对每个接点来说都是唯一的有时间写代码测试一下并更新本贴! ------------------------------------------------------------------------经测试,其结点id确实是唯一的 ;而且在NetworkManager中有如下方法,用于取得和设置结点id/***Getterforproperty'peerID'.**@returnValueforproperty'peerID'.*/publicPeerIDgetPeerID(){returnpeerID;}/***Setterforpro
阅读全文
posted @
2011-09-03 10:00
网络大豆
阅读(234)
推荐(0) 编辑
Failed to login to this group: xxx. Error=0
摘要:莫名其妙抛出该异常,跟踪源码带调试,n久未果。最后清理缓存目录.jxta,搞定!特纪录与此...
阅读全文
posted @
2011-09-03 09:50
网络大豆
阅读(274)
推荐(0) 编辑
发现两个有关Netbeans RCP开发的项目
摘要:OpenBlueSkyOpenBlueSky is a set of components for the NetBeans Platform. PlatformXWhat is PlatformX? A lot of people build applications with the NetBeans RCP/Platform. There should be a place where the general-purpose things people write can go live and be of benefit to others. A peer-maintained rep
阅读全文
posted @
2011-09-02 13:49
网络大豆
阅读(582)
推荐(0) 编辑