func (p *Plugin) Stop() error {
	atomic.StoreInt64(&p.closing, 1)
	const op = errors.Op("activity_plugin_stop")
	pool := p.getPool()
	if pool != nil {
		p.pool = nil
		err := pool.Destroy(context.Background())
		if err != nil {
			return errors.E(op, err)
		}
		return nil
	}
	return nil
}
Stop stops the serving plugin.
package activity
import (
	"context"
	"sync"
	"sync/atomic"
	"time"
	"github.com/cenkalti/backoff/v4"
	"github.com/spiral/roadrunner-plugins/v2/config"
	"github.com/spiral/roadrunner/v2/events"
	"github.com/spiral/roadrunner/v2/state/process"
	rrWorker "github.com/spiral/roadrunner/v2/worker"
	roadrunner_temporal "github.com/temporalio/roadrunner-temporal"
	"github.com/spiral/errors"
	"github.com/spiral/roadrunner-plugins/v2/logger"
	"github.com/spiral/roadrunner-plugins/v2/server"
	"github.com/temporalio/roadrunner-temporal/client"
)
const (
	PluginName = "activities"
)
type Plugin struct {
	temporal client.Temporal
	events   events.Handler
	server   server.Server
	log      logger.Logger
	mu       sync.Mutex
	reset    chan struct{}
	pool     activityPool
	graceTimeout time.Duration
	closing      int64
}
func (p *Plugin) Init(temporal client.Temporal, server server.Server, log logger.Logger, cfg config.Configurer) error {
	const op = errors.Op("activity_plugin_init")
	if !cfg.Has(roadrunner_temporal.RootPluginName) {
		return errors.E(op, errors.Disabled)
	}
	if temporal.GetConfig().Activities == nil {
		return errors.E(op, errors.Disabled)
	}
	p.temporal = temporal
	p.server = server
	p.events = events.NewEventsHandler()
	p.log = log
	p.reset = make(chan struct{})
	p.graceTimeout = cfg.GetCommonConfig().GracefulTimeout
	return nil
}
func (p *Plugin) Serve() chan error {
	const op = errors.Op("activity_plugin_serve")
	errCh := make(chan error, 1)
	pool, err := p.startPool()
	if err != nil {
		errCh <- errors.E(op, err)
		return errCh
	}
	p.pool = pool
	go func() {
		for range p.reset {
			if atomic.LoadInt64(&p.closing) == 1 {
				return
			}
			err := p.replacePool()
			if err == nil {
				continue
			}
			bkoff := backoff.NewExponentialBackOff()
			bkoff.InitialInterval = time.Second
			err = backoff.Retry(p.replacePool, bkoff)
			if err != nil {
				errCh <- errors.E(op, err)
			}
		}
	}()
	return errCh
}