Plan. .Net Remoting. 2. Modèle de programmation. 1. Introduction. 1. Introduction 2. Modèle de programmation

Documents pareils
.NET remoting. Plan. Principes de.net Remoting

TD Objets distribués n 3 : Windows XP et Visual Studio.NET. Introduction à.net Remoting

Programme Compte bancaire (code)

Le MSMQ. Version 1.0. Pierre-Franck Chauvet

Intergiciels pour la répartition CORBA : Common Object Request Broker. Patrice Torguet torguet@irit.fr Université Paul Sabatier

RMI le langage Java XII-1 JMF

Intergiciel - concepts de base

Remote Method Invocation (RMI)

RMI. Remote Method Invocation: permet d'invoquer des méthodes d'objets distants.

Composants Logiciels. Le modèle de composant de CORBA. Plan

Pour signifier qu'une classe fille hérite d'une classe mère, on utilise le mot clé extends class fille extends mère

Chapitre 10. Les interfaces Comparable et Comparator 1

Héritage presque multiple en Java (1/2)

Cette application développée en C# va récupérer un certain nombre d informations en ligne fournies par la ville de Paris :

Chapitre 2. Classes et objets

CORBA. (Common Request Broker Architecture)

Hébergement et configuration de services WCF. Version 1.0

Projet gestion d'objets dupliqués

NFP111 Systèmes et Applications Réparties

Cours Master Recherche RI 7 Extraction et Intégration d'information du Web «Services Web»

Java Naming and Directory Interface

Le cadre des Web Services Partie 1 : Introduction

Plan du cours. Historique du langage Nouveautés de Java 7

1 Introduction. 2 Les contrats. 3 Les bindings. 4 Hébergement. 5 Consommation. 6 WCF et remoting. 7 Sessions, instantiations et concurrence

Chapitre I Notions de base et outils de travail

Systèmes répartis. Fabrice Rossi Université Paris-IX Dauphine. Systèmes répartis p.1/49

Programmation par les Objets en Java

Premiers Pas en Programmation Objet : les Classes et les Objets

TP n 2 Concepts de la programmation Objets Master 1 mention IL, semestre 2 Le type Abstrait Pile

Serveur d'archivage 2007 Installation et utilisation de la BD exist

Programmation répartie RPC & RMI

Objets et Programmation. origine des langages orientés-objet

Introduction aux «Services Web»

Apache Camel. Entreprise Integration Patterns. Raphaël Delaporte BreizhJUG

OS Réseaux et Programmation Système - C5

La carte à puce. Jean-Philippe Babau

Généralités sur le Langage Java et éléments syntaxiques.

Gestion distribuée (par sockets) de banque en Java

Remote Method Invocation en Java (RMI)

Remote Method Invocation Les classes implémentant Serializable

TD/TP PAC - Programmation n 3

Tutoriel: Création d'un Web service en C++ avec WebContentC++Framework

Une introduction à Java

Institut Supérieur de Gestion. Cours pour 3 ème LFIG. Java Enterprise Edition Introduction Bayoudhi Chaouki

ALOHA LOAD BALANCER METHODE DE CONTROLE DE VITALITE

Module.NET 3 Les Assemblys.NET

Java Licence Professionnelle CISII, Cours 2 : Classes et Objets

Introduction à Java. Matthieu Herrb CNRS-LAAS. Mars

Structure d un programme et Compilation Notions de classe et d objet Syntaxe

Langage Java. Classe de première SI

Info0604 Programmation multi-threadée. Cours 5. Programmation multi-threadée en Java

Les Threads. Sommaire. 1 Les Threads

Conception de serveurs d'applications ouverts

Polycopié Cours Programmation Orientée Objet sous Java Programme : Filière SMI S5

Java - RMI Remote Method Invocation. Java - RMI

Mobile OGSI.NET: Grid Computing on Mobile Devices

Environnements de Développement

TD/TP PAC - Programmation n 3

Page 1 sur 5 TP3. Thèmes du TP : l la classe Object. l Vector<T> l tutorial Interfaces. l Stack<T>

Calcul Parallèle. Cours 5 - JAVA RMI

Cours 1: Java et les objets

Messagerie asynchrone et Services Web

Introduction aux. services web 2 / 2

Encapsulation. L'encapsulation consiste à rendre les membres d'un objet plus ou moins visibles pour les autres objets.

[APPLICATON REPARTIE DE VENTE AUX ENCHERES]

Utiliser Java sans BlueJ

LMI 2. Programmation Orientée Objet POO - Cours 9. Said Jabbour. jabbour@cril.univ-artois.fr

Manuel d implémentation des Web Services Sous Axis1 et Axis2/Tomcat/linux. Par Pr Bouabid EL OUAHIDI

RAPPELS SUR LES METHODES HERITEES DE LA CLASSE RACINE Object ET LEUR SPECIALISATION (i.e. REDEFINITION)

Création d objet imbriqué sous PowerShell.

Principes. 2A-SI 3 Prog. réseau et systèmes distribués 3. 3 Programmation en CORBA. Programmation en Corba. Stéphane Vialle

Package Java.util Classe générique

Software Engineering and Middleware A Roadmap

XML, PMML, SOAP. Rapport. EPITA SCIA Promo janvier Julien Lemoine Alexandre Thibault Nicolas Wiest-Million

JADE : Java Agent DEvelopment framework. Laboratoire IBISC & Départ. GEII Université & IUT d Evry nadia.abchiche@ibisc.univ-evry.

Le hub d entreprise est une application de déploiement des applications mais aussi un outil de communication

Architecture JEE. Objectifs attendus. Serveurs d applications JEE. Architectures JEE Normes JEE. Systèmes distribués

Java - la plateforme

Introduction aux intergiciels

Introduction à la plateforme J2EE

JAVA TD0. Prise en main du langage Environnement de base JAVA 1

Java Licence Professionnelle CISII,

Projet Active Object

Introduction à la Programmation Parallèle: MPI

Initiation à JAVA et à la programmation objet.

Architectures n-tiers Intergiciels à objets et services web

Faculté de Génie Chaire industrielle en infrastructures de communication. La technologie XML. Wajdi Elleuch

Java c est quoi? Java pourquoi?

Introduction à CORBA

WEBSERVICES. Michael Fortier. Master Informatique 2ème année. A308, Université de Paris 13

18 TCP Les protocoles de domaines d applications

IFIPS 5 / Nouvelles Architectures Logicielles Projet : Bus de web services avec «moteur» BPEL

SOAP Concepts Application à Glassfish

CORBA haute performance

Chapitre VI- La validation de la composition.

La base de données XML exist. A. Belaïd

Java DataBaseConnectivity

21 mars Simulations et Méthodes de Monte Carlo. DADI Charles-Abner. Objectifs et intérêt de ce T.E.R. Générer l'aléatoire.

as Architecture des Systèmes d Information

2 Chapitre 1 Introduction

Transcription:

Plan.Net Remoting 1. Introduction Lionel Seinturier INRIA Futurs Lille Projet JACQUARD Université Pierre & Marie Curie Lionel.Seinturier@lifl.fr 3. Caractéristiques techniques 3.1. Invocation 3.2. Paramètres 3.3. Activation de serveurs 4. Configuration 5. Fonctionnalités avancées 6/9/04.Net Remoting 1 Lionel Seinturier 6. Comparaison.Net Remoting 2 Lionel Seinturier 1. Introduction.Net Remoting Principe Solution Microsoft pour interopérabilité client/serveur entre objets.net distants - successeur de DCOM (trop complexe) - très proche de Java RMI et de CORBA/IIOP Principe : interaction client/serveur client + serveur + proxy.net génère dynamiquement un objet proxy - mêmes méthodes que l'objet serveur - chaque méthode redirige l'appel vers l'objet serveur proxy rés eau Install prog. client masquée au sein d'un appel de méthode requête rés eau réponse prog. serveur! l'interface (méthodes) de l'objet serveur doit être connue côté client! 3 programmes - client.exe - serveur.exe (classe + classe Install) - itf.dll - contient l'interface du seveur - partagée par client.exe et serveur.exe.net Remoting 3 Lionel Seinturier.Net Remoting 4 Lionel Seinturier

Classe namespace System.Remoting classe : hérite de MarshalByRefObject méthodes publiques namespace Cote { class : MarshalByRefObject, I { public string SayHello() { return "Hello world"; namespace ItfPartagee { public interface I { string SayHello(); Installation objet(s) serveur(s) Concept de channel = canal de communication entre le client et le serveur 2 existants à la base - TCP avec un format de message binaire - HTTP avec un format de message SOAP (XML) Possibilités de créer de nouveaux channels et/ou de nouveaux formats -IIOP -SMTP - (voir sur Internet).Net Remoting 5 Lionel Seinturier.Net Remoting 6 Lionel Seinturier Installation objet(s) serveur(s) using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp; namespace Cote { class Install { static void main(string[] args) { TcpChannel chan = TcpChannel(1704); ChannelServices.RegisterChannel(chan); RemotingConfiguration.RegisterWellKnownServiceType( typeof(), "hello", // URI WellKnownObjectMode.SingleCall ); Console.ReadLine(); Classe namespace Cote { class Install { static void main(string[] args) { I proxy = (I) Activator.GetObject( typeof(i), "tcp://localhost:1704/hello" ); string ret = proxy.sayhello(); Rq : channel HTTP http://localhost:1704/hello Rq : JavaRMI, CORBA : port choisi, pas de service de noms (rq: en programmer un).net Remoting 7 Lionel Seinturier.Net Remoting 8 Lionel Seinturier

3. Caractéristiques 3 types d'invocations 3.1 Invocations 3.1. Invocation 3.2. Paramètres 3.3. Activation de serveurs Synchrone Semi-synchrone (ou asynchrone avec retour) Asynchrone (ou oay) Invocation synchrone Cas par défaut.net Remoting 9 Lionel Seinturier.Net Remoting 10 Lionel Seinturier 3.1 Invocations Invocation semi-synchrone (asynchrone avec retour) Aucun changement côté serveur Côté client Notion de delegate : ~pointeur de fonction méthode pour déclencher l'appel : BeginInvoke méthode pour récupérer le résultat : EndInvoke Invocation asynchrone (oay) 3.1 Invocations Côté serveur attribut méthode [OneWay()] dans l'interface et la classe serveur 1 seul message d'appel, pas de retour (! pas de type de retour autre que void) Côté client idem semi-synchrone (BeginInvoke) EndInvoke retourne toujours immédiatement (avant réception côté serveur) delegate string SayHello(); SayHelloDelegate shd = SayHelloDelegate(proxy.SayHello); IAsyncResult res = shd.begininvoke(null,null);... string ret = shd.endinvoke(res); Rq : SayHelloDelegate générée par le framework namespace ItfPartagee { public interface I { [OneWay()] void Ping(); namespace Cote { class : MarshalByRefObject, I { [OneWay()] public void Ping() { Console.WriteLine("Ping() reçu");.net Remoting 11 Lionel Seinturier.Net Remoting 12 Lionel Seinturier

2 types de passage de paramètres 3.2 Paramètres - types de base (int, float, string, ) : par valeur - objets : par valeur (sérialisation) ou par référence 3.2 Paramètres Passage de paramètre par référence Transmission d'un objet d'une classe qui hérite de MarshalByRefObject class : MarshalByRefObject, I {... class Factory: MarshalByRefObject, IFactory { public I New() { return (); Factory.Net Remoting 13 Lionel Seinturier.Net Remoting 14 Lionel Seinturier Passage de paramètre par valeur 3.2 Paramètres 2 types d'activations 3.3 Activation de serveurs Transmission d'un objet d'une classe associée à l'attribut Serializable [Serializable] public class Personne { string nom; public Personne(string nom) { this.nom=nom; public string GetNom() { return nom; class Entreprise: MarshalByRefObject, IEntreprise { public Personne NewPersonne() { return Personne(); Entreprise Personne par le serveur par le client Activation par le serveur 2 possibilités pour chaque classe d'objet singleton : 1 seule instance single call : 1 instance par invocation RemotingConfiguration.RegisterWellKnownServiceType( typeof(), "hello", // URI WellKnownObjectMode.Singleton ); ou.singlecall.net Remoting 15 Lionel Seinturier.Net Remoting 16 Lionel Seinturier

Activation par le client 3.3 Activation de serveurs 1 instance par client le client demande explicitement la création de(s) l'instance(s) 2 outils soapsuds fichiers XML 4. Configuration Côté serveur RemotingConfiguration.ApplicationName = "MyServer"; RemotingConfiguration.RegisterActivatedServiceType( typeof() ); Côté client RemotingConfiguration.RegisterActivatedType( typeof(), "tcp://localhost:1704/sayhello" ); proxy = (); string ret = proxy.sayhello(); soapsuds But : éviter l'écriture de l'assembly partagée (itf.dll) entre le client et le serveur! soapsuds utilitaire qui génère les informations à partir du serveur soapsuds -url:http://localhost:1704/hello?wsdl oa:itf.dll.net Remoting 17 Lionel Seinturier.Net Remoting 18 Lionel Seinturier Fichiers XML 4.2 Fichiers XML Installation objet serveur 4.2 Fichiers XML But : éviter de programmer les paramètres de configuration (channel, port, URI, ) <configuration> <system.runtime.remoting> <application> <service> <wellknown type = ", " <!-- classe, assembly --> mode = "SingleCall" objecturi = "hello" /> </service> <channels> <channel ref="http" port="1704" /> </channels> </application> </system.runtime.remoting> </configuration> class Start { static void Main(string[] args) { RemotingConfiguration.Configure("remoting.xml"); Console.WriteLine(" pret"); Console.ReadLine(); Avantage : dynamicité i.e. pas de recompil. en cas changement param. dans XML Inconvénient : aléas de la "programmation en XML".Net Remoting 19 Lionel Seinturier.Net Remoting 20 Lionel Seinturier

5. Fonctionnalités avancées Ramasse-miettes (garbage collection) Constat : objets factory créant des objets accesibles à distance class Factory : MarshalByRefObject, IFactory { public I NewCreate() { return (); class : MarshalByRefObject, I {... Pb : libérer les objets (ressources) non utilisés par les clients Difficulté : environnement réparti Solution connue (DCOM) : comptage de référence Factory 5.1 Ramasse-miettes Pb : perte de message de déréférencement? Solution connue : ping Pb : pas forcément possible en environnement HTTP/firewall Solution : mécanisme de bail (lease) chaque objet crée est associé à un bail (par défaut : 10min) à chaque appel de méthode, bail renouvelé (par défaut : 2min) éventuellement appels explicite à ILease.Re() à l'expiration du bail, le lease manager interroge les sponsors (clients précédents) pour connaître l'état de l'objet! si pas de demande de renouvellement, à la poubelle.net Remoting 21 Lionel Seinturier.Net Remoting 22 Lionel Seinturier Personnalisation des baux 5.1 Ramasse-miettes surcharge de la méthode InitializeLifetimeServices hérité de MarshalByRefObject using System.Runtime.Remoting.Lifetime; class : MarshalByRefObject, I { public override object InitializeLifetimeService() { ILease lease = (ILease) base.initializelifetimeservice(); lease.initialleasetime = TimeSpan.FromMilliseconds(10); lease.sponsorshiptimeout = TimeSpan.FromMilliseconds(10); lease.reoncalltime = TimeSpan.FromMilliseconds(10); return lease; class Install { static void main(string[] args) { LifetimeServices.LeaseManagerPollTime = TimeSpan.FromMilliseconds(10);....Net Remoting 23 Lionel Seinturier 6. Comparaison.Net Java RMI CORBA IIOP principe c/s c/s c/s def. interface dist. C, VB, Java CORBA IDL serveur noms non oui oui invoc. sync. oui oui oui invoc. semi-sync. oui non oui invoc. async. oui non oui invoc. statique oui oui oui invoc. dyn. non non oui param. par valeur oui oui oui param. par ref. oui oui oui gen. dyn. proxy oui oui (1.5) non activation par serveur oui oui oui singleton/singlecall [ permanente/à la demande ] activation par client oui non non.net Remoting 24 Lionel Seinturier

6. Comparaison.Net Java RMI CORBA IIOP protocole TCP, HTTP JRMP, IIOP GIOP, IIOP IIOP, données bin, SOAP, bin bin ramasse-miettes oui oui (JRMP) non personnalisation Channels RMISocket Portable Interceptors Formatters Factory.Net Remoting 25 Lionel Seinturier