Java-index »» Core »

RMI and versioning

935 byte By syt000a at 2007-11-27 6:56:13
I have a client/server app that uses RMI to communicate. I have a few questions. I'm new to RMI so if what I'm asking doesn't make much sense, correct me.I deploy the client and server. Now I update the remote interface to add new functionality by adding a new method, I thought that this ...

JTable Scrolling to Last Row

831 byte By GideonRaya at 2007-11-27 6:57:13
Hi,I have a table wherein every time I add a new row it will automatically scroll to the last row. But if i add a row with a bigger height, the last row is not totally shown. Please see my code below.private void scrollToLast(JTable table){int lastRow = table.getRowCount() - 1;Rectangle rec = ...

Java inherited annotations

1078 byte By fusionsoft-onlinea at 2007-11-27 6:57:19
Dear colleagues.There is some inconvenience concerning using of java annotations. I annotated some interfaces and methods within them. Then I made some derived interfaces and classes and tried to get my annotations here. Unfortunately annotations whose had been made for base classes were ...

Noob seeks to emulate javascript array

2032 byte By Mata at 2007-11-27 6:57:33
anyone have any suggestions for emulating this behavior described below?I need a way to have an indexed list, which will store undefined indexes. Hashtable<Integer,blah> could do it, but the thing is that the integers are unordered. they aren't indexes.The other way to describe it is an ...

java networked application

321 byte By coffeeandsunshinea at 2007-11-27 6:57:39
I am a student developing an application where two remore users are posting images and drawing on a paper (like a shared whiteboard) - could anyone advise me as to how best go about this? how to deal with concurrency and making sure it is synchronised. How to keep the two applications in sync ...

Example from Angelica Langer FAQ - need help

1806 byte By AdrianSosialuka at 2007-11-27 6:57:50
Hi everyone,I found this example in the FAQ:interface Acceptor<V> { void accept( Task<V> task, V v);}interface Task<U> { void go(Acceptor<? super U> acceptor);}class AcceptingTask<U> implements Task<U> { public void go(Acceptor<? super U> acceptor) {U ...

creating array of generic object

1435 byte By fraksiaa at 2007-11-27 6:58:02
hello, what i want to do is something like:public class AClass<K extends SomeObject>{SomeObject[] AnArray;public void amethod() {AnArray=new K[10];}}So I want to create an array of some kind of object at runtime without already know the kind of the object. The thing is that I think that ...

Error in finalizer after LDAP search with referrals

1741 byte By Yeva at 2007-11-27 6:58:58
have rather weird problem. Web application executes LDAP search against Active directory GC. It does it in a standard steps: 1. Creates hash table with parameters 2. Creates InitialDirContext 3. Execute search using search objects, filter etc. 4. Enumerates result using hasMoreElements and next ...

Multiple Byte Arrays Down One Socket

576 byte By DJHotIcea at 2007-11-27 6:58:59
I have an application where I wish to take 4 byte arrays and push it down one socket in one continuous stream. Then the other end will take it and decode it into four byte arrays again. Anybody have a solution for this? The byte arrays are in a ring buffer so i would have to be writing data ...

old problem

2205 byte By cuongdeutsch2@yahoo.coma at 2007-11-27 6:59:12
so,i can not solve this problem :i have wrote a eseay RMI API:import java.rmi.*;public interface Calculator extends Remote{public int addNum(int x,int y) throws RemoteException;}import java.rmi.*;import java.rmi.server.UnicastRemoteObject;public class CalculatorImpl implements ...

Is there a way to overload the Map's toString() function?

7772 byte By lokiea at 2007-11-27 6:59:34
Hello everyone. I was wondering if its possible to overload the toString() function of the Map datastructure supplied by java.I looked it up and it says:public class HashMapextends AbstractMapSo I looked up AbstractMap and it says:public abstract class AbstractMapextends Objectimplements MapAnd ...

Finding the thread ids instantiated at runtime

1083 byte By ramaniarun01a at 2007-11-27 6:59:37
Hi,I want to know if there is any way to know the threads that are instantiated at runtime from outside the class or package. To be more clear, I am building a module to enhance JSWAT (Open source java debugger ) to visualize the concurrent execution(monitor based) of multithreaded ...

how to start GC logs?

1480 byte By bhaarat_javaa at 2007-11-27 6:59:38
helloi was reading this article http://www.jivesoftware.com/jive/entry.jspa?externalID=701and i wanted to track my GC logs. we start our jvm using this script. can someone please tell me what arguments would i need to and how i would edit this script to start the JVM in verbose mode or start GC ...

DBSCAN

77 byte By itsnava4u@yahoo.co.ina at 2007-11-27 7:00:43
hi,If anybody have the DBSCAN implementation please send to me.

Can a variable name be declared as List name?

344 byte By Pachia at 2007-11-27 7:00:45
Hi All,Developing a chat application. Wanted to store the data according to the scope. The scope will be different for different rooms. My doubt is can a variable name(scope name) be declared as a List name? Everytime a new scope is created, a new list has to be generated at the server ...

How to ivoke a method on an object of a private class

62 byte By hsy541a at 2007-11-27 7:01:06
When I did it I got a java.lang.IllegalAccessException.

run GC remote

68 byte By chnada at 2007-11-27 7:02:43
can i run GC from my jconsole when i connect to it an remote?

two threads having a common input reader

535 byte By manishmulani@nitka at 2007-11-27 7:03:32
hello friends!!in one of my projects i'm having two parallel threads running, each having a BufferedReader object. Each of these objects gets inputStream from a common socket.the problem is, when something is input into the socket, only one of the threads reads that input at a time.. while i ...

TCP works only with IP right?

173 byte By sim085a at 2007-11-27 7:03:43
TCP works only with IP right? Then if I want to communicate with a devise that does not have an IP (my television) I cannot use TCP right?Regards,Sim085

Accessing a queue

199 byte By Ehsan.Sa at 2007-11-27 7:03:54
HelloI have a queue that is filled every week and accessed by other programs. How can I make this queue thread safe and allow programs to access it one by one.cheers,ehsan

problem with RMI with SSL

2748 byte By RMI_SSLa at 2007-11-27 7:04:09
HI everyone.I wrote a server in RMI which is secure with SSL.When I run the program I receive a lot of exception.I'm little novice so I need some explanation.The code where I'm create the SSL socket is:public class RMISSLServerSocketFactoryimplements RMIServerSocketFactory, ...

Waiting all threads in a fixed thread pool

875 byte By KwangHooia at 2007-11-27 7:04:18
Hello, may I know how can I wait for all the threads in a fixed thread pool to be completed, without calling shutdownNow?Executor pool = Executors.newFixedThreadPool(nThreads);for(int i = 0; i < 10000; i++)pool.execute(new StockHistoryRunnable(code));// blah blah blah//// I would like to ...

Why Are These Type Incompatable?

2191 byte By DejasPerPera at 2007-11-27 7:04:41
Consider:public interface SyntaxNode extends Node<SyntaxNode>public interface ParentSyntaxNode extends SyntaxNodepublic class StatementListNode extends ParentSyntaxNodeBase // < implements ParentSyntaxNode{private Set<? extends StatementNode> _statements;public Set<? extends ...

Console messsages

1723 byte By Valasua at 2007-11-27 7:05:02
I would like to suppress the following messages appearing in the console.How to do that?--Jun 11, 2007 1:38:05 PM ClientCommunicatorAdmin restartWARNING: Failed to restart: java.net.ConnectException: Connection refused: connectJun 11, 2007 1:38:06 PM ClientIntermediary closeINFO: ...

Threads BLOCKED

406 byte By tlloretia at 2007-11-27 7:05:06
Hi,i've got an application with several threads which:- perform database operations (insert, update, select ..)- call external programs using Process p=Runtime.getRuntime().exec(cmdString); sometimes they got BLOCKED.1. How can I know the cause which blocked my threads?2. What "Good Practices" ...

Is it a port problem?

9660 byte By asyed01a at 2007-11-27 7:05:33
Hi Folks!I am new in java and working on a client server application. I am running server on port 5000. After that client connects to server on this port. Now after client connects I want to send 2 numbers to client to process. In my code I on server I am not able to send those 2 numbers to ...

Syndication with RMI?

1329 byte By Fascisticidea at 2007-11-27 7:05:46
I am not sure if syndication if the proper term. Syndication usually refers to rss, but what we want to do is not rss.So here is what we want to do, and I'd like your opinion on the use of RMI to do it.It is a application that will run on users computers, active in the system tray, and that ...

Should I use synchronization for this scenario

3489 byte By trusted_uniksa at 2007-11-27 7:05:56
I'm fairly new to the more advanced concepts of java programming so I apologize in advance if this is a dumb question. Any help would be appreciated as I'm always wanting to increase my understanding.Here is a bit of background info:I am using two Vectors to update two JLists. The first ...

Thread Pooling Design Question

809 byte By novicekumara at 2007-11-27 7:06:22
Hi -I am new to java and i have a task to complete using ThreadPooling. I am using JDK1.4 so i have decided to use the api provided by Doug Lea. Basically i will have to process around 20000 documents daily which are in the database and each document has an ID associated and there is no ...

remote class loading for the purpose of casting

2184 byte By suppona at 2007-11-27 7:06:43
i have an object, to which i append a container.this container has objects of type that are not known on theremote host.// this is the local machinepublic class Record1 implements Interface1, Serializable { public double d = -1; public List<String>;} ....public class Agent implements ...

Lock with counter

697 byte By KwangHooia at 2007-11-27 7:06:50
Hello all,I wish to have a lock with the following features.1. My main thread will create a lock with counter 5. Then my main thread will spawn n threads to perform some task. My main thread will wait for the lock forever, until the counter become 0.2. The worker threads will decrease the ...

Connection is good, but Client & Server can't communicate

11904 byte By choey2k5a at 2007-11-27 7:06:53
I have created a simple 1:1 chat application to practice the java.net package.I know it's more efficient to split it to the Server version and the Client version, but I really wanted to do it this way =pHere's how it works: run the app and create a server; then, run it again to connect to ...

Which List should be used, to remove in a thread safe way?

705 byte By KwangHooia at 2007-11-27 7:06:59
Hello all,I plan to have a List, where n number of Threads will accessing the List.When two or more thread trying to remove an equals items from the List, only one of the thread will remove successfully (i,e, remove(Object o) will return true). The rest of the threads will realize remove(Object ...

WaitForMultipleObject feature in Java

1272 byte By KwangHooia at 2007-11-27 7:07:14
Current, I have a method, which will perform lock on void MyWait(){CountDownLatch.aWait// We can have access to the Stop lock.}void MyStop(){// Signal Stop lock.}This works fine until we need to stop the thread from keep waiting on CountDownLatch, when there is a stop signal. (The method who ...

solving a program using linked lists

245 byte By puspaa at 2007-11-27 7:08:23
I need to solve a program using linked lists...the program details are as follows.this is a hierarchy of employee and supervisor.how will i print the names of the respective employees and supervisors whichever i need?

Using OpenType class

739 byte By kaouaa at 2007-11-27 7:09:52
Hi,I've created an MBean, i've put it in a first project (A) and put its implementation in a second one (B).I have access to the methods thanks to the interface from project A in the following way :MBeanServerConnection conn = connectToJMXServer();CachesMBean caches = ...

MBean required to get the Memory Usage of Specific Appln. in jboss,weblogic

236 byte By Jay.Jambaa at 2007-11-27 7:09:53
Hie ,I want to know the specific Mbean name or the Domain under which i can get the "Memory usage" or such critical attributes of specific application in jboss and in weblogic application Server.Thanks

NIO The SocketChannel is always readable after send a request?

925 byte By nightingalea at 2007-11-27 7:10:52
It seems the SocketChannel is always readable after send a request. I tested and found that but I'm not sure if it is right? More detail: --Create a SocketChannel, connect to server in non blocking mode, register to Selector for connecting (SelectionKey.OP_CONNECT) , after finishConnect(), ...

Is there any disadvantage of using BigInteger?

351 byte By xemaa at 2007-11-27 7:11:07
Is there any performance related disadvantage for using BigInteger.The reason why is use BigInteger is to convert a byte array to hex string.I have seen other functions which does the same. but since Biginteger does that in a single line of code i chose it... and now i wanna know any way the ...

Problem reading ArrayList of String[] from serialized file

2321 byte By Galstuka at 2007-11-27 7:12:39
Using Java 6.0 and getting unchecked conversion warning on an ArrayList cast when reading an ArrayList of String[] from a serialized file at compile time.The general thrust of the code follows:private static java.util.List<String[]> databaseAlias = new ArrayList<String[]>(); // ...

Strange behavior of ZipInputStream

1424 byte By yann74a at 2007-11-27 7:14:34
I have a problem with ZipInputStream. Essentially, I receive and InputStream (that's why I cannot use ZipFile), and I need to unzip it and read all its entries. The problem is that the entries are xml files, so I need to build the dom, but when I call DocumentBuilder.parse, it reads all the ...

HTTPClient.executeMethod(getmethod) is throwing java.net.UnknownHostExcepti

2233 byte By MithunKa at 2007-11-27 7:16:31
Hi all,I am trying to execute below code,public static void main(String[] args){HttpClient client = new HttpClient();// an example only... replace this with your siteGetMethod method = new GetMethod(" http://www.google.co.in/");try {// get the response code, hopefully "successful" (SC_OK, or ...

Sockets + ObjectInputStream, Retrieving Invalid Data for Security

606 byte By TuringPesta at 2007-11-27 7:27:53
If I have a Socket listening for data and im using an ObjectInputStream,how do I retrieve the data of any failed readObject() attempts?Should I subclass an InputStream and override the read methodsto copy the data (or at least make it accessible during an error)?I could then reset the copy ...

illegal monitor exception

6908 byte By jamesgoslina at 2007-11-27 7:27:56
import java.util.*;import java.io.BufferedReader;import java.io.DataInputStream;import java.io.IOException;import java.io.PrintWriter;import java.net.Socket;import java.net.UnknownHostException;import javax.swing.table.DefaultTableModel;public class tClient{ static int port = 8084;static String ...

SSLHandshakeException with jconsole

2856 byte By DieselDavea at 2007-11-27 7:28:43
I am trying to get JMX over SSL to work with a standalone server java app using jconsole as the client. I am configuring JMX via a file specified with the com.sun.management.config.file system property on the command line.I have it working fine without SSL, but with SSL enabled ...

which one:rmi, rpc, webservice, cleint server

489 byte By thomas-spa at 2007-11-27 7:30:51
HelloSun developed RMI and Java RPC for java.I have not so much experience with both of them but from what i see and what i read they are not widely spread. In my environment there is nobody how could tell me who and which industry use them.But since the web services get more and more use in ...

JMX with Kerberos

207 byte By syntern@sch.bme.hua at 2007-11-27 7:31:59
Hello,Is there any example how we could secure the JMX management and monitoring with Kerberos based authentication? At least what steps are required to achieve this?Thanks,Istvan

java.lang.ClassCastException: com.sun.jndi.rmi.registry.RegistryContext

1519 byte By NIkon_DSLa at 2007-11-27 7:34:26
Hello all.I'm new at JMX and trying to use it in our systemThe code looks like that//create serverJMXServiceURL addr = new JMXServiceURL("rmi", "127.0.0.1", port);RMIConnectorServer connector = new RMIConnectorServer(addr, null, server);JMXHelper.registerMBeanOrAdapter(server, ...

Executor interface in JDK 1.5

64 byte By Priyoa at 2007-11-27 7:34:30
Sample code to explain the concept of Executor in JDK 1.5

How to get a core dump on Windows NT?

456 byte By khan_maqboola at 2007-11-27 7:34:41
The java process is running as a NT service, so I think I can't use the ctrl+break option.I need to have this dump generated both on demand and also when the JVM crashes?I have used IBM's core dump analyzer to analyze the core dumps generated by Websphere's JVM. Would this work for a Sun JVM ...