草庐IT

thread_name

全部标签

java.rmi.ServerException : RemoteException occurred in server thread (ClassNotFoundException) 异常

以下方法:privatevoidstartServer(){//snippetthatstartstheserveronthelocalmachinetry{RemoteMethodImplimpl=newRemoteMethodImpl();Naming.rebind("Illusive-Server",impl);}catch(Exceptionexc){JOptionPane.showMessageDialog(this,"Problemstartingtheserver","Error",JOptionPane.ERROR_MESSAGE);System.out.println

java - Thread.sleep 等待时间超过预期

以下代码:longmsBefore=System.currentTimeMillis();//Thread.currentThread().setPriority(Thread.MAX_PRIORITY);try{Thread.sleep(200);}catch(InterruptedExceptione){}System.out.println("Time:"+(System.currentTimeMillis()-msBefore));打印:Time:578Time:594Time:625Time:640Time:641Time:609Time:625Time:625Time:61

java - hibernate 异常 : Could not obtain transaction-synchronized Session for current thread

我遇到错误:Exceptioninthread"main"org.hibernate.HibernateException:Couldnotobtaintransaction-synchronizedSessionforcurrentthread主要ppService.deleteProductPart(cPartId,productId);@Service("productPartService")@OverridepublicvoiddeleteProductPart(intcPartId,intproductId){productPartDao.deleteProductPart

java - JavaFX 中的复杂并发 : using ObservableLists and Properties from multiple worker threads

我有多个工作线程和一个JavaFXGUI,它报告这些线程中发生的事情。线程之间共享的数据很多,需要可视化。所以我使用ObservableList和Property能够轻松地在JavaFX中显示数据。我制作了一个小示例应用程序来展示与我的应用程序中发生的情况类似的内容。它有2个列表,工作线程将数据从一个列表移动到另一个列表。状态字符串保持最新。完整的示例代码可以在http://codetidy.com/6569/找到(此代码会崩溃,稍后查看)这是共享的ObservableList的&属性:privateObservableListnewItems;privateObservableLis

java - org.hibernate.hql.ast.QuerySyntaxException : TABLE NAME is not mapped

我有两个模型,Item和ShopSection。它们之间存在多对多关系。@Entity(name="item")publicclassItemextendsModel{@ManyToMany(cascade=CascadeType.PERSIST)publicSetsections;}@Entity(name="shop_section")publicclassShopSectionextendsModel{publicListfindActiveItems(intpage,intlength){returnItem.find("selectdistinctifromItemijoin

java - 无法实例化类 : org. apache.naming.java.javaURLContextFactory

我正在处理加载SQL文件并将其加载到Oracle中的Junit测试文件:importjava.io.BufferedReader;importjava.io.File;importjava.io.FileReader;importjava.sql.Connection;importjava.sql.SQLException;importjava.sql.Statement;importjavax.naming.Context;importjavax.naming.InitialContext;importjavax.naming.NamingException;importjavax.

java - Thread-Safe在java中是什么意思或者什么时候我们叫Thread-Safe?

我不理解这个概念。publicclassSomeName{publicstaticvoidmain(Stringargs[]){}}这是我的类(class)SomeName。现在这里的线程是什么。我们是否将类称为线程。当其他对象试图访问它的方法或成员时,我们是否将此类称为线程?当其他对象试图访问这个对象时,我们是否将这个类称为线程?当我们在java中将某些东西称为线程安全时,这意味着什么? 最佳答案 线程安全意味着避免一些问题。最常见也可能是最糟糕的称为线程锁。古老的类比是哲学家用餐的故事。他们非常有礼貌,不会在别人夹菜的时候伸出筷

java - 自定义解决JAXB "name collision in the ObjectFactory class"问题

在thesexsdfiles上执行“xjc”命令返回TwodeclarationscauseacollisionintheObjectFactoryclass因为有2个元素名为“Scale”和“scale”。根据thispage,可以通过使用自定义xsd文件来解决此问题。.你知道怎么做吗?你有绑定(bind)文件的例子吗? 最佳答案 您可以使用绑定(bind)标签。将schemaLocation属性设置为特定xsd的位置。子标记、schemaBindings和包,然后为该xsd定义一个新的包namespace。下面是我刚才使用xjc

java - 如何在 wicket 应用程序中使用 tomcat 管理器中的 "Guessed User name"?

在TomcatManager的“SessionsAdministration”页面上,有一列GuessedUsername。我如何从我的Wicketsession中设置此列?注意:我已成功覆盖AuthenticatedWebSession.toString()并且此值显示在sessin详细信息页面上。我已尝试按照建议设置AuthenticatedWebSession.userNamehere. 最佳答案 请注意,Wicketsession与实际的servletsession不同。在wicketsession中创建“userName”

java - 如果在同步方法中调用,thread.yield() 是否会失去对对象的锁定?

据我所知,Thread.currentThread().yield()是对线程调度程序的通知,它可以将cpu周期分配给其他具有相同优先级的线程(如果存在)。我的问题是:如果当前线程锁定某个对象并调用yield(),它会立即失去该锁定吗?当线程调度程序发现没有这样的线程分配cpu周期时,调用了yield()的线程将再次争取锁定它之前丢失的对象?我在javadoc和论坛中找不到它[http://www.coderanch.com/t/226223/java-programmer-SCJP/certification/does-sleep-yield-release-lock]有50-50答