Spring Framework HotSwappableTargetSource - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework HotSwappableTargetSource class.

This code example shows how to use the following methods:swap
    protected MailSender setMailSender(MailSender ms) {
        HotSwappableTargetSource hsts =
        return (MailSender) hsts.swap(ms);
    protected MailSender setNoopMailSender() { 
        MailSender old;
        final Mock proxy = new Mock(MailSender.class);
        proxy.setDefaultStub(new DefaultResultStub());
        old = setMailSender((MailSender) proxy.proxy());
        return old;
This code example shows how to use the following methods:
                return standbyDataSource; 
            return activeDataSource; 
        HotSwappableTargetSource targetSource = new HotSwappableTargetSource(activeDataSource); 
        ProxyFactory pf = new ProxyFactory(); 
        pf.setInterfaces(new Class[] { DataSource.class }); 
        if (isPositiveFailoverEnable()) { 
            DataSource targetDetectorDataSource = descriptor.getTargetDetectorDataSource(); 
            DataSource standbyDetectorDataSource = descriptor.getStandbyDetectorDataSource(); 
            if (targetDetectorDataSource == null || standbyDetectorDataSource == null) { 
                throw new IllegalArgumentException( 
                        "targetDetectorDataSource or standbyDetectorDataSource can't be null if positive failover is enabled."); 
            // 1. create active monitoring job for failover event 
            ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); 
See Code Examples for Spring Framework HotSwappableTargetSource Methods: