Skip to content

Commit

Permalink
defer loading of the native code
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Ruby committed Jun 27, 2000
1 parent e834812 commit e216b89
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sapi/servlet/servlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public class servlet extends HttpServlet {
/* native methods */
/******************************************************************/

static { reflect.loadLibrary("servlet"); }
public native void startup();
public native long define(String name);
public native void send(String requestMethod, String queryString,
Expand Down Expand Up @@ -124,7 +123,12 @@ public void write(String data) {

public void init(ServletConfig config) throws ServletException {
super.init(config);
if (0 == startup_count++) startup();

// first time in, initialize native code
if (0 == startup_count++) {
reflect.loadLibrary("servlet");
startup();
}

// try to find the addHeader method (added in the servlet API 2.2)
// otherwise settle for the setHeader method
Expand Down

0 comments on commit e216b89

Please sign in to comment.