Questions tagged [dynamic-proxy]

A Dynamic Proxy is a class that implements a list of interfaces specified at runtime such that a method invocation through one of the interfaces on an instance of the class will be encoded and dispatched to another object through a uniform interface.

A Dynamic Proxy is a class that implements a list of interfaces specified at runtime such that a method invocation through one of the interfaces on an instance of the class will be encoded and dispatched to another object through a uniform interface. Thus, a dynamic proxy class can be used to create a type-safe proxy object for a list of interfaces without requiring pre-generation of the proxy class, such as with compile-time tools. Method invocations on an instance of a dynamic proxy class are dispatched to a single method in the instance's invocation handler, and they are encoded with a java.lang.reflect.Method object identifying the method that was invoked and an array of type Object containing the arguments.

Dynamic proxy classes are useful to an application or library that needs to provide type-safe reflective dispatch of invocations on objects that present interface APIs. For example, an application can use a dynamic proxy class to create an object that implements multiple arbitrary event listener interfaces (interfaces that extend java.util.EventListener) to process a variety of events of different types in a uniform fashion, such as by logging all such events to a file.

226 questions
0
votes
1 answer

Castle windsor proxy generate memory leak

Castle windsor is used in MVC application as it is described here: Plugging Windsor in MVC In my application there is one difference and that is method AddControllerLoggingFunctionality: var controller =…
Simon
  • 1,955
  • 5
  • 35
  • 49
0
votes
1 answer

Generating Interface Proxies

Ran into an issue with a class; I have a class that looks like: public class MyPresenter { public MyPresenter(IMyView view) { } } public class SomePresenter { public SomePresenter(ISomeView view) { } } The custom views inherit from a base…
Brian Mains
  • 50,520
  • 35
  • 148
  • 257
0
votes
1 answer

How can I (or should I) apply Aspect Advice to a dynamic proxy?

Say I have Spring AOP configured like @Configuration @EnableAspectJAutoProxy @ComponentScan class Config { ... } and I have some interface, ProxiableInterface. I implement it with ProxiableInterface pi = (ProxiableInterface)…
Lucas Ross
  • 1,049
  • 8
  • 17
0
votes
1 answer

parameter sequence is incorrect in dynamically generated code

By using Dynamic Proxy namespace, I am trying to create and consume a WCF service dynamically. I have declared a contract like below: [OperationContract] long GetStrings(string sinput, int n, out List lstStrings); on Client side, I am…
Pratik Gaikwad
  • 1,526
  • 2
  • 21
  • 44
0
votes
1 answer

Wrap ActiveX to Intercept Calls (ActiveX Proxy wrapper)

I have a deeply ingrained ActiveX control in our system which I would like to learn about / fix! I am thinking about wrapping this MFC dll with a transparent proxy class that will intercept the member etc. HOW can this be approached in MFC. Thanks!
divinci
  • 22,329
  • 11
  • 45
  • 56
0
votes
1 answer

WCF and with DynamicProxies

I have a service that use EF 6.1.3 to access to the database. I have POCO entities to store the results of EF, but the resutls are dynamicProxies instead of the POCO entity. The problem is that when the service try to send to the client this dynamic…
Álvaro García
  • 18,114
  • 30
  • 102
  • 193
0
votes
1 answer

Why simple set and then get on Dynamic Proxy does not persist? (using TinkerPop Frames JavaHandler)

I wanted to add simple getters and setters on a class that implements VertexFrame and I used JavaHandlers for those. For those methods I didn't want to have any interaction with the database. Unfortunately there is not something like @Ignore so I…
0
votes
1 answer

How to create a dynamic Wrapper?

In some parts of my Program I need to pass around a set of Objects (also some primitive types) between my classes. For every new combination I have to create a pretty "stupid" wrapper-class which just contains two or three fields. (int, String or…
Qohelet
  • 1,459
  • 4
  • 24
  • 41
0
votes
2 answers

Can I make the compiler and the CLR ignore non implemented interfaces on my types?

I would like to define a type implementing a certain interface, however I would only implement it in a proxy at runtime. I can see two obstacles in this scenario : 1-Make the compiler ignore non implemented interfaces. 2-Make the CLR ignore(or at…
Thiago Padilha
  • 4,590
  • 5
  • 44
  • 69
0
votes
0 answers

Dynamic proxy for class

I have a simple class: public class Some { [F("some text")] public void Foo() { //Do something } } External code use my class by calling Foo method. It's search an attribute F, creates an instance of the Some class and then calls Foo method.…
Gattaka
  • 147
  • 1
  • 9
0
votes
1 answer

jvm hanging while connecting to database

hi in websphere application jvm is hanging twice in two months crashing the entire application,so need to know whether it is because of slow database connection or driver issue.The log snippet is There is/are 1 thread(s) in total in the server…
mahan07
  • 887
  • 4
  • 14
  • 32
0
votes
2 answers

Using Dynamic Proxies to centralize JPA code

Actually, This is not a question but really I need your opinions in a matter... I put his post here because I know you always active, so please don't consider this a bad question and share me your opinions. I've used Java dynamic proxies to…
Muhammad Hewedy
  • 29,102
  • 44
  • 127
  • 219
0
votes
2 answers

Getting UndeclaredThrowableException in a Thrift call

I am getting this java.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy1.getMyObject(Unknown Source) I went through a similar post here and this article posted in one the comments . But in this case the I am calling following…
holmes840
  • 1,063
  • 2
  • 11
  • 24
0
votes
1 answer

MassTransit: Message contracts, polymorphism and dynamic proxy objects

TL;DR On contract subscription, how can I get the raw message content or the original published object, rather than a dynamic proxy? I am having a bad time trying to create a modular application based on MassTransit. My idea is to have a…
vtortola
  • 34,709
  • 29
  • 161
  • 263
0
votes
1 answer

Castle DynamicProxy v1 exception when proxy-ing methods with parameters?

I'm having problems proxying metods with parameters using Castle DynamicProxy v1.1.5.0. - I get the exception "Index was outside the bounds of the array." If I only use methods with no parameters, OR DynamicProxy v2, everything works…
Cristian Diaconescu
  • 34,633
  • 32
  • 143
  • 233