草庐IT

is_derived_from_Wrap

全部标签

Java 套接字错误 : Reading Strings from Socket's InputStream

我正在使用Socket与ServerSocket通信。字符串正在从服务器发送到我的套接字。每个不同的行都是一条消息,在解析时包含信息。要读取这些文本行,需要使用扫描器。问题在于数据“突飞猛进”。虽然Server在连续均匀的发送数据,但是client端的Scanner读取的数据好像有停顿,一下子读入一堆消息(30-40条),然后又停顿。它无限期地重复这个循环。如果我提高发送数据的速率,暂停的持续时间会减少;如果我放慢数据速度(每秒1条消息),错误仍然存​​在并且暂停变得很长。这几乎就好像Socket在将任何数据发送到Scanner之前等待其缓冲区溢出;然后刷新所有内容并再次等待溢出。但是

java - 单例对象工厂 : is this code thread-safe?

我有一个用于许多单例实现的通用接口(interface)。接口(interface)定义了可以抛出检查异常的初始化方法。我需要一个工厂来按需返回缓存的单例实现,想知道以下方法是否线程安全?UPDATE1:请不要建议任何第三部分库,因为由于可能的许可问题,这将需要获得法律许可:-)更新2:此代码可能会在EJB环境中使用,因此最好不要产生额外的线程或使用类似的东西。interfaceSingleton{voidinit()throwsSingletonException;}publicclassSingletonFactory{privatestaticConcurrentMap>CACH

java - 组织.hibernate.HibernateException : collection is not associated with any session

我的一个friend在开源软件OscarMcmaster中遇到了一个特殊问题。他让我帮忙,我能够找到导致问题的代码。下面是一个方法:publicBillingServicegetBillingCodeByCode(Stringcode){Listlist=billingServiceDao.findBillingCodesByCode(code,"BC");if(list==null||list.size()==0){returnnull;}return(BillingService)list.get(0);}billingServiceDao由Spring容器初始化:privates

java - IntelliJ IDEA : Project SDK Settings is not retained after reopenning IDE

每当我打开IDEA时,它都会花一些时间进行索引,然后显示很多错误。我必须转到“项目设置”并选择SDK。不知何故,IDE在关闭时忘记了我的设置并返回到“项目SDK:”。我真的很感激任何线索。 最佳答案 尝试创建一个新项目,看看问题是否仍然存在。JDK配置按名称存储在.idea目录中,验证此目录中的XML文件未被外部更改(例如,通过Dropbox或版本控制)。misc.xml文件应该包含如下内容:模块.ipr文件可以定义模块特定的JDK:JDK定义本身存储在IDEAconfigurationdirectory中在options\jdk.

java - Spring 安全 : excluding WSDL document from requiring authentication

我创建了一个AxisWeb服务作为在Tomcat7上运行的Java6应用程序。为了安全,集成了SpringSecurity2.0.1框架。出于安全目的,应该使用基本身份验证来保护服务端点。但是,WSDL文档应该是公开的。我创建了一个像这样的Spring安全配置:问题是无论拦截url行的顺序如何,该行似乎总是应用和行被忽略。我本以为可以以某种方式控制行为,例如通过指定顺序(以便SpringSecurity选择第一个或最后一个匹配规则)或通过规则的特殊性,以便SpringSecurity选择最具体的规则,即在这种情况下最后带有“wsdl”的规则。如何排除WSDL文档进行身份验证,同时为实际

java - org.hibernate.hql.internal.ast.QuerySyntaxException : is not mapped [from Team]

我正在开发小型SpringMVCCRUD应用程序。遇到一些奇怪的问题:配置类:packagesbk.spring.simplejc.config;importjava.util.Properties;importjavax.annotation.Resource;importjavax.sql.DataSource;importorg.springframework.context.annotation.Bean;importorg.springframework.context.annotation.ComponentScan;importorg.springframework.co

java.lang.IllegalArgumentException : error Type referred to is not an annotation type 异常

我得到以下建议:-@Before(value="@annotation(loggable)",argNames="joinPoint,loggable")publicvoidbefore(JoinPointjoinPoint,Loggableloggable){Classclazz=joinPoint.getTarget().getClass();MethodSignaturemethodSignature=(MethodSignature)joinPoint.getSignature();Methodmethod=methodSignature.getMethod();Stringm

java - “Your security settings have blocked a local application from running” Java 8

我正尝试在我的Chrome窗口中运行一个小程序,但收到错误消息。我确实看到所有回复都告诉我将我的安全级别更改为中等,但版本8中不存在该选项。到目前为止,几个小时的谷歌搜索和向同学寻求帮助都没有取得任何进展。谁能给我点建议? 最佳答案 Medium在Java8u20中被移除:Medium(removedfromJava8Update20andlaterversions)Onlyunsignedapplicationsthatrequestallpermissionsareblocked.Allotherapplicationsarea

Java 泛型 : Bound mismatch: The type is not a valid substitute for the bounded parameter of the type

我遇到了以下问题:我有这些类和接口(interface)定义publicabstractclassViewModelRefreshPostListFragment>extendsRefreshPostListFragmentimplementsIRefreshPostView{privatefinalViewModelHelpermViewModeHelper=//errorherenewViewModelHelper();...}publicabstractclassRefreshPostViewModelextendsAbstractViewModel{}publicclassVi

java - Checkstyle Java 泛型 : '?' is not preceded with whitespace

我正在使用插件maven-checkstyle-plugin2.17它有6.11.2checkstyle版本。关于空格的配置是:我总是得到这个错误:(whitespace)WhitespaceAround:WhitespaceAround:'?'isnotprecededwithwhitespace.(whitespace)WhitespaceAround:WhitespaceAround:'?'isnotfollowedbywhitespace.Emptyblocksmayonlyberepresentedas{}whennotpartofamulti-blockstatement(