Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 20th November 2011
Linuxmania Linuxmania is offline
Ceriwiser
 
Join Date: Nov 2011
Posts: 392
Rep Power: 15
Linuxmania mempunyai hidup yang Normal
Default [ask] java RMI

gan ane mau tanya tentang RMI gan....

ane ad tugas d kampus dan ane dapet source code dari tmn gan...

untuk clientnya ane mayan ngerti gan, tp masalah di servernya gan... TT



ane punya banyak pertanyaan ni gan... TT

Rmi itu seperti ap si gan...?

interface itu ap gan...?

implement itu sama ky extend gan...??

trow itu gunanya buat ap gan..??

ane da coba cari d google gan

tp ane ttp ga ngerti....

otak ane kurang cerdas kynya gan...





lalu d program yang ane dapet ada 2 interface gan...

ane ga ngerti sama sekali bacanya.....




Spoiler for inteface task:






public interface task

{

T execute();

}












Spoiler for interface serverInt:






import java.rmi.Remote;

import java.rmi.RemoteException;



public interface serverInt extends Remote {

T executeTask(task t) throws RemoteException;

}













gan itu tanda buat apa ya gan..??

sama trownya... YY



trus d class cliet mainnya




Spoiler for interface clientMain:






import java.rmi.registry.*;



public class clientmain

{ static opserver op;

static serverInt comp;

public static void main(String[] args)

{ int act;

if (System.getSecurityManager() == null) {

System.setSecurityManager(new SecurityManager()); }


try {

String name = "stoks";

Registry registry = LocateRegistry.getRegistry(args[0]);

comp = (serverInt) registry.lookup(name);

op=new opserver();

//tampilkan GUI

GUI d=new GUI();

d.setVisible(true); }

catch (Exception e)

{ System.err.println("Client exception:");

e.printStackTrace();}

}

}











if (System.getSecurityManager() == null) {

System.setSecurityManager(new SecurityManager()); }


try {

String name = "stoks";

Registry registry = LocateRegistry.getRegistry(args[0]);

comp = (serverInt) registry.lookup(name);

op=new opserver();

yang di atas itu buat apa ya gan..??

serverInt itu dy manggil intervace server int ya gan..??

opserver itu ap ya gan..??




Spoiler for servermain:






import java.rmi.*;

import java.rmi.registry.*;

import java.rmi.server.UnicastRemoteObject;



public class servermain

{ public static void main(String[] args)

{ //set securitymanager

if (System.getSecurityManager() == null) {

System.setSecurityManager(new SecurityManager());

}

try {

String name = "stoks";

serverInt engine = new server();

serverInt stub = (serverInt) UnicastRemoteObject.exportObject(engine,0);

Registry registry = LocateRegistry.getRegistry();

registry.rebind(name, stub);


System.out.println("ComputeEngine bound");}

catch (Exception e)

{ System.err.println("ComputeEngine exception:");

System.out.println(e);

e.printStackTrace(); }

}

}











serverInt engine = new server();

serverInt stub = (serverInt) UnicastRemoteObject.exportObject(engine,0);

Registry registry = LocateRegistry.getRegistry();

registry.rebind(name, stub);

command d atas buat apa ya gan..??



mohon pencerahannya gan....

da mau gila ane..... TT

maap tanyanya banyak banget

</div>
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Terkait
Thread Thread Starter Forum Replies Last Post
JUAL Kumpulan Source Code Visual Basic, VB Net, Java, Java Script, ASP, PHP, Delphi, C grosirdvd CD/DVD 199 24th November 2013 07:06 PM
Dibutuhkan cepat programmer Java J2EE dan Java J2SE InsentifGede Lowongan kerja 0 23rd October 2012 10:39 PM
JUAL Visual Basic 6, .Net, Delphi, Java App, Java Web, C#, Foxpro, Web Design, Asp, Php mousekompi Software Original & Open Source 0 26th May 2012 10:50 AM
workshop java(belajar java 1 semster dalam 2 pertemuan aja) Linuxmania Programming 0 20th November 2011 09:55 AM

 


All times are GMT +7. The time now is 06:13 PM.