首页 | 一月 2006 >>

What does the exception "java.net.SocketException: Connection reset by peer" mean? How can this be avoided?

It usually happens when the connection was reset by the peer -- that is, when the client unexpectedly closed the socket. This happens when the user clicks "stop", or "reload", or "back", or enters a new URL, or closes his Internet connection, while a resource is still being downloaded (before your server gets to close its socket). This is normal behavior and you shouldn't worry about it.

The server is reporting "connection reset by peer" in the middle of a request. That means one of the following things:

  • The browser started a request and the user pressed STOP.
  • The browser started an request in one frame and JavaScript on another frame told it to go somewhere else (which has the same effect as a user pressing STOP).
  • You have a meta refresh reload someplace that is firing so fast that the previous request hasn't had a chance to complete yet. The five second periodicity makes me pretty suspicious of this.
  • You have some network component in between (a router or proxy) that is misbehaving.
  • You have some completely separate connection attempts going on that are disobeying the HTTP protocol (such as doing a telnet connection to port 8080 and then disconnecting).
标签 : ,

java URLConnection and timeout and non-blocking io

自从JDK1.5以后java.net.URLConnection加入了setConnectTimeout(int timeout),但是也有办法在JDK1.5以前获得这个功能。
Adding Socket Timeout to java.net.URLConnection
HTTPClient Version 0.3-3
The Jakarta Commons HttpClient
另外,可以通过以下两个语句来设置相应的超时:
System.setProperty("sun.net.client.defaultConnectTimeout", 连接超时毫秒数);
System.setProperty("sun.net.client.defaultReadTimeout", 读数据超时毫秒数);
参见:http://java.sun.com/j2se/1.4.2/docs/guide/net/properties.html
google:set Timeout on URLConnection

标签 :

Non-blocking IO and blocking queues

Well performing NIO code is a Good Thing. But getting details of how to do it right is difficult. The examples supplied with the JDK are complete noddy. There's a link on Sun's site to an example but that has a race condition. O'Reilly's NIO book cops out on how to use Selector properly. The thing that could make that book useful.

阅读全文……

标签 :

怎样成为优秀的软件模型设计者?


作者:Scott Ambler著,乐林峰 译 本文选自:www.umlchina.com

我们期待自己成为一个优秀的软件模型设计者,但是,要怎样做,又从哪里开始呢?

将下列原则应用到你的软件工程中,你会获得立杆见影的成果。

阅读全文……

国内不谈Java--硅谷有感

快被传烂的文章,但道理还在!

阅读全文……

中国软件输在哪里

评论:中国软件输在哪里?

阅读全文……

JAVA开发者应该去的20个英文网站

[http://www.javaalmanac.com] - Java开发者年鉴一书的在线版本. 要想快速查到某种Java技巧的用法及示例代码, 这是一个不错的去处. 
[http://www.onjava.com] - O'Reilly的Java网站. 每周都有新文章. 
[http://java.sun.com] - 官方的Java开发者网站 - 每周都有新文章发表. 
[http://www.developer.com/java] - 由Gamelan.com 维护的Java技术文章网站. 
[http://www.java.net] - Sun公司维护的一个Java社区网站. 
[http://www.builder.com] - Cnet的Builder.com网站 - 所有的技术文章, 以Java为主. 
[http://www.ibm.com/developerworks/java] - IBM的Developerworks技术网站; 这是其中的Java技术主页. 
[http://www.javaworld.com] - 最早的一个Java站点. 每周更新Java技术文章. 
[http://www.devx.com/java] - DevX维护的一个Java技术文章网站. 
[http://www.fawcette.com/javapro] - JavaPro在线杂志网站. 
[http://www.sys-con.com/java] - Java Developers Journal的在线杂志网站. 
[http://www.javadesktop.org] - 位于Java.net的一个Java桌面技术社区网站. 
[http://www.theserverside.com] - 这是一个讨论所有Java服务器端技术的网站. 
[http://www.jars.com] - 提供Java评论服务. 包括各种framework和应用程序. 
[http://www.jguru.com] - 一个非常棒的采用Q&A形式的Java技术资源社区. 
[http://www.javaranch.com] - 一个论坛,得到Java问题答案的地方,初学者的好去处。 
[http://www.ibiblio.org/javafaq/javafaq.html] - comp.lang.java的FAQ站点 - 收集了来自comp.lang.java新闻组的问题和答案的分类目录. 
http://java.sun.com/docs/books/tutorial/] - 来自SUN公司的官方Java指南 - 对于了解几乎所有的java技术特性非常有帮助. 
http://www.javablogs.com] - 互联网上最活跃的一个Java Blog网站. 
http://java.about.com/] - 来自About.com的Java新闻和技术文章网站.

标签 :

An Open Source Java SQL Database System-Mckoi SQL

Mckoi SQL Database is an SQL (Structured Query Language) Database management system written for the JavaTM platform. Mckoi SQL Database is optimized to run as a client/server database server for multiple clients, however it can also be embedded in an application as a stand-alone database. It is highly multi-threaded and features an extendable object-oriented engine.

Mckoi SQL Database started as an internal project and has since evolved from its inception in 1998. The main goals of the project are a code base that is simple to maintain and extend, ease of use and administration, robustness, multiple concurrent access, and performance.

阅读全文……

[SQLServer 2000 Driver for JDBC]Error establishing socket.

原链接地址
1. Make sure that SQL Server is set to mixed authentication. To do this, open enterprise manager, right click on server/properties; go to security tab and select SQL Server and Windows Authentication. Apparently, the driver from Microsoft cannot handle windows integrated authentication.

2. Keeping the server properties dialog up, go to the general tab and push the network configuration button. Enable TCP/IP (it is disabled by default). If you wish, press properties to change the default port (1433).

3. Add an SQL Server login account (NOT a WINDOWS account (see 1)). You can also use your sa account, but I don't recommend it.

4. Use the login setup in step 3.

Some final notes:
(1) I've seen ads for third party drivers that can use Windows integrated authentication. Try one if you need this feature.
(2) One responder suggested telneting to port 1433 to verify TCP connectivity. The connection is refused on my machine even though I can connect through the driver. And this is how it should be; otherwise there'd be a security risk.

架构宣言: MDA 实战

利用 Spring、Hibernate 和 JBoss 的简易步骤

在这一期文章中,把已经学到的关于 MDA 的知识应用于实践,了解如何使用开放源码的模型驱动架构(MDA)工具来简化 Spring-Hibernate 的开发。

阅读全文……

标签 :

Java 理论与实践: 并发在一定程度上使一切变得简单

util.concurrent 包简介

对于每个项目,象许多其它应用程序基础结构服务一样,通常无需从头重新编写并发实用程序类(如工作队列和线程池)。这个月,Brian Goetz 将介绍 Doug Lea 的 util.concurrent 包,这是一个高质量的、广泛使用的、并发实用程序的开放源码包。

阅读全文……

标签 : ,

Java 理论与实践: 线程池与工作队列

线程池有助于实现最佳资源利用率

英文地址中文地址

阅读全文……

标签 : ,

Java 理论与实践: 嗨,我的线程到哪里去了?

了解如何避免服务器应用程序中的线程泄漏

英文地址
中文地址

阅读全文……

WebSphere的SystemOut.log的日志中发现J2CA0075W的警告

ConnectionMan W J2CA0075W: 处理方法 allocateMCWrapper 时应该存在活动的事务。

阅读全文……

标签 : ,

The Jakarta Commons Sandbox ——Proxy

使用Java动态代理可以延迟初始化对象,使程序更安全,记录对象行为,性能监控

阅读全文……

标签 :

如何在Linux/Unix运行一个守护Java程序

Daemon - Daemon : Java based daemons or services

Introduction

Actualy only the UNIX like platforms are supported. The sources are located in the src/native/unix subdirectory of the project sources. For win32 platfroms the cygwin emulation layer is used. See cygwin for more informations.

In the futur APR may be used to provide more convinient platform support.

http://wrapper.tanukisoftware.org

Configurable tool which allows Java applications to be installed and controlled like native NT or Unix services.
Includes fault correction software to automatically restart crashed or frozen JVMs. Critical when app is needed 24x7. Built for flexibility
to run my app:
nohup java -jar JarFile.jar </dev/null >>myLogFile 2>>myErrorFile&
标签 :

自己编写实现java.util.Comparator自定义排序规则

自己编写实现java.util.Comparator自定义排序,List列表排序,多列组合排序

阅读全文……

标签 :

MAP SET LIST 的不同

讨论MAP SET LIST 的不同

阅读全文……

标签 :

使用Putty通过Java HTTPProxy Socks代理服务器访问外部网络

Putty V0.58 可以通过代理服务器连接外部网络(Internet或者内部其他局域网),穿透防火墙。
SSHProxy是一个简单而且有用的Socks4 Socks5代理服务器,可以通过SHTTP Proxy 实现二级代理

阅读全文……

标签 :

urlrewrite重写/隐藏你的链接

  • Browser Detection - Allows you to rewrite URLs based on request HTTP headers (such as user-agent or charset).
  • Date based rewriting - Allows you to forward or redirect to other URL's based on the date/time (good for planned outages).
  • 阅读全文……

    标签 :